From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A126C4705A for ; Tue, 16 Dec 2025 17:12:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A1884042E; Tue, 16 Dec 2025 17:12:43 +0100 (CET) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by mails.dpdk.org (Postfix) with ESMTP id 4BC564026D for ; Tue, 16 Dec 2025 17:12:37 +0100 (CET) Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-8b2d56eaaceso529957785a.0 for ; Tue, 16 Dec 2025 08:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytheb-org.20230601.gappssmtp.com; s=20230601; t=1765901556; x=1766506356; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=AJQGCUgioeCPwZiOo/fUsPuwY85Xku0ucL3t2Uwyiv8=; b=R2FcCBkMbSNpE4kneK4i5awdwADve2uiwEscldgP0QeEHbc/qOEyLP7jA5zzoMoxnC WFaEgBvYh2AJsTMz60996k0OXms0/XcO+6iJifp4AJSkzxtL8AxzLmg5em15tJNhCUBD enOLwWfpQfcD9I/oWQeocJdjzmZCbrtmCqg8rPxSnZBogjwkzS16QYA1s2KSUZhyuaL2 OhwhbrJ0KzG6Fya6DP8dh853El5ckN2OX1+WM6ujxvIiCJIVtCZTZpj4fKQRP2wmgrA6 7WtOgAphhBJnrtYiixvaWNJLn3TErNzOqwnG8pSu6lMiC032OYOY6Dt14fGATSTLG1Zs S4Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765901556; x=1766506356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=AJQGCUgioeCPwZiOo/fUsPuwY85Xku0ucL3t2Uwyiv8=; b=tm3P85BvDwm/WW73gA4uXi/HGoFg+0t6yeaCMtMUH6jWxeZfzh7tbmhQIEOEe27234 /a+Pd/qtuE/BU7NF2j3dOct1Szkf4ceANgPkVhhYBg1pctYw9wGOQ/dANjwtEKRFg8Ch PEjL4uxcUfOQNwa/YRNYkdOk/EA6ew9MwyCHjxUbeOodjJCTq3kRSnW4AW0b2zjfhgwk LvxLeuxrDfTIkDqLr2SIRzAmCvhkCtC8xVECQPR+EomQ6p5PWvMfxoBkIQkwI4RK3dkB ukLF20WZ4jaeeDhnhkrHdZC/l35FrGBCZMgZhlYPwGvTBL7/dZi/H0YM3wqbSW34gaQc b9dQ== X-Gm-Message-State: AOJu0YysSNAR0NbTmnG5suz5qHXmayuotBf+ClKazyiyVXKZ+rEOBqO7 PxNa5Wy1TNkTtTQIq93I/rJrecuJsOpgWBoqfBYni6uTXDztfagglNJaG72cpf33GEOg96E6bTi kOdCy X-Gm-Gg: AY/fxX5vKzr08vfHFAHZxF0V/EKMFm6s/1vxd+XsXUbC9xrRy39R+gEfVvpu1IvHITg hbcOqPyjzy2YDC14ygm2VvPO/GGKwHIbvSm/S5Cbg6yZM/td4bqfVJJYyBQUka4SltGDHlVg1JL YYYrxmc53y//pwhLRCw4wlhFo6Grs/WocVIp0agy7IS+C7hR7l0H+k0YfZCRYt9g15ycciFDxvU UYoHMD9cALynjcSToXzcgPF9MK9jxI+e9bLKum9nyzPLy0xoSQRSvuuoKRz1sQib7pCjYXL6J0S UZkuPCo7Otbuam/wJZaGCXUNUjJdJR1kW6oED38V8m2A+Mg5cg1WeHL0sWs73Vf6G11fLKuTnUR lMTrlgjMPMcAKiL/DP01x7AYj0jxBhDDOzViVQ6BqSmCIZmsquXMQSR2XY0maYo2xj//6gRHXbh VPjFTPkRATUL+3WSo5OA== X-Google-Smtp-Source: AGHT+IG6EPGpWuSkaJRdP54n8GaANKEb/281CCA5JU30o1XlAPZIijKjbk65reba4375eovk9ntfEw== X-Received: by 2002:a05:620a:2699:b0:8b2:ea3f:2f91 with SMTP id af79cd13be357-8bb3b3701e8mr1994528185a.81.1765901555838; Tue, 16 Dec 2025 08:12:35 -0800 (PST) Received: from RHTRH0061144.redhat.com ([47.14.5.10]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8be31b66d74sm212265985a.40.2025.12.16.08.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 08:12:35 -0800 (PST) From: 0-day Robot To: test-report@dpdk.org, Stephen Hemminger Subject: |SUCCESS| pw159227 [PATCH v5 16/17] vhost: check for overflow in xstat name Date: Tue, 16 Dec 2025 11:12:33 -0500 Message-ID: <20251216161233.762647-1-robot@bytheb.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251207191242.165619-17-stephen@networkplumber.org> References: <20251205022948.327743-1-stephen@networkplumber.org> <20251207191242.165619-1-stephen@networkplumber.org> <20251207191242.165619-17-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: test-report@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: automatic DPDK test reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: test-report-bounces@dpdk.org Test-Label: 0day Robot - Claude SONNET Test-Status: SUCCESS http://dpdk.org/patch/159227 _AI Review Comments Available_ Git SHA: Not provided in patch Author: Stephen Hemminger Subject: vhost: check for overflow in xstat name This patch adds overflow checking to the xstat name formatting in the vhost library by capturing the return value of snprintf and logging a warning if the formatted string is truncated. > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c > index 416f082dca..540f4e0635 100644 > --- a/lib/vhost/vhost.c > +++ b/lib/vhost/vhost.c > @@ -2200,6 +2200,7 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id, > { > struct virtio_net *dev = get_device(vid); > unsigned int i; > + int ret; > > if (dev == NULL) > return -1; > @@ -2213,10 +2214,15 @@ rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id, > if (name == NULL || size < VHOST_NB_VQ_STATS) > return VHOST_NB_VQ_STATS; > > - for (i = 0; i < VHOST_NB_VQ_STATS; i++) > - snprintf(name[i].name, sizeof(name[i].name), "%s_q%u_%s", > - (queue_id & 1) ? "rx" : "tx", > - queue_id / 2, vhost_vq_stat_strings[i].name); > + for (i = 0; i < VHOST_NB_VQ_STATS; i++) { > + ret = snprintf(name[i].name, sizeof(name[i].name), "%s_q%u_%s", > + (queue_id & 1) ? "rx" : "tx", > + queue_id / 2, vhost_vq_stat_strings[i].name); > + if (ret >= (int)sizeof(name[0].name)) > + VHOST_CONFIG_LOG("device", NOTICE, "truncated xstat '%s_q%u_%s'", > + (queue_id & 1) ? "rx" : "tx", > + queue_id / 2, vhost_vq_stat_strings[i].name); > + } Should the function return an error code when truncation occurs? The current implementation logs the truncation but continues processing, potentially leading to duplicate or ambiguous xstat names if multiple entries are truncated to the same length. Also, does the comparison use the correct array element for the size check? The code uses sizeof(name[0].name) in the overflow check but formats into name[i].name in the snprintf call.