From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932494AbdLGRYF (ORCPT ); Thu, 7 Dec 2017 12:24:05 -0500 Received: from mailout.easymail.ca ([64.68.200.34]:52544 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932420AbdLGRYD (ORCPT ); Thu, 7 Dec 2017 12:24:03 -0500 Reply-To: shuah@kernel.org Subject: Re: [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror) To: julien.boibessot@free.fr, Valentina Manea , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Shuah Khan , Shuah Khan Cc: Julien BOIBESSOT References: <1512486544-32760-1-git-send-email-julien.boibessot@free.fr> From: Shuah Khan Message-ID: <9e2c6629-4059-dc08-ef2b-1af7692fd429@kernel.org> Date: Thu, 7 Dec 2017 10:23:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1512486544-32760-1-git-send-email-julien.boibessot@free.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/05/2017 08:09 AM, julien.boibessot@free.fr wrote: > From: Julien BOIBESSOT > > Fixes following build error: > vhci_driver.c: In function 'refresh_imported_device_list': > vhci_driver.c:118:37: error: 'snprintf' output may be truncated before > the last format character [-Werror=format-truncation=] > snprintf(status, sizeof(status), "status.%d", i); > ^~~~~~~~~~~ > vhci_driver.c:118:4: note: 'snprintf' output between 9 and 18 bytes into > a destination of size 17 > snprintf(status, sizeof(status), "status.%d", i); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > Signed-off-by: Julien BOIBESSOT > --- > tools/usb/usbip/libsrc/vhci_driver.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c > index 5727dfb..a9ce431 100644 > --- a/tools/usb/usbip/libsrc/vhci_driver.c > +++ b/tools/usb/usbip/libsrc/vhci_driver.c > @@ -106,7 +106,7 @@ static int parse_status(const char *value) > return 0; > } > > -#define MAX_STATUS_NAME 16 > +#define MAX_STATUS_NAME 18 > > static int refresh_imported_device_list(void) > { > I have been thinking about this some and if it indeed a large ncontrollers value that makes the buffer overflow, we might have a bigger problem. That said, this patch looks good to fix the warming. Greg, Could you please pick this patch up. Acked-by: Shuah Khan thanks, -- Shuah