lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023100226-cloak-tissue-7efa@gregkh>
Date:   Mon, 2 Oct 2023 13:45:37 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Minas Harutyunyan <hminas@...opsys.com>,
        Ben Dooks <ben@...tec.co.uk>, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...e.de>, linux-usb@...r.kernel.org
Subject: Re: [PATCH] usb: dwc2: gadget: Fix a warning when compiling with W=1

On Sat, Sep 23, 2023 at 12:54:24PM +0200, Christophe JAILLET wrote:
> In order to teach the compiler that 'hs_ep->name' will never be truncated,
> we need to tell it that 'epnum' is not negative.
> 
> 'epnum' comes from in a 'for' loop in dwc2_gadget_init(), starting at 0
> and ending at 255. (hsotg->num_of_eps is a char)
> 
> When building with W=1, this fixes the following warnings:
> 
>   drivers/usb/dwc2/gadget.c: In function ‘dwc2_hsotg_initep’:
>   drivers/usb/dwc2/gadget.c:4804:55: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
>    4804 |         snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir);
>         |                                                       ^~
>   drivers/usb/dwc2/gadget.c:4804:52: note: directive argument in the range [-2147483645, 255]
>    4804 |         snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir);
>         |                                                    ^~~~~~~~
>   drivers/usb/dwc2/gadget.c:4804:9: note: ‘snprintf’ output between 6 and 17 bytes into a destination of size 10
>    4804 |         snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir);
>         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixes: 5b7d70c6dbf2 ("USB: Gadget driver for Samsung HS/OtG block")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Looks like the kernel test robot didn't like this one :(

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ