From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Krishna Kurapati PSSNV <quic_kriskura@quicinc.com>
Cc: Johan Hovold <johan@kernel.org>,
kernel test robot <lkp@intel.com>,
oe-kbuild-all@lists.linux.dev, linux-usb@vger.kernel.org,
Bjorn Andersson <andersson@kernel.org>,
Johan Hovold <johan+linaro@kernel.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Subject: Re: [usb:usb-testing 7/12] drivers/usb/dwc3/core.c:1482:69: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 4
Date: Thu, 25 Apr 2024 08:18:28 -0700 [thread overview]
Message-ID: <2024042510-jazz-send-be09@gregkh> (raw)
In-Reply-To: <d4e11bc4-3561-4e2e-9203-5d794269a225@quicinc.com>
On Thu, Apr 25, 2024 at 10:38:47AM +0530, Krishna Kurapati PSSNV wrote:
>
>
> On 4/24/2024 12:11 PM, Johan Hovold wrote:
> > On Wed, Apr 24, 2024 at 01:03:07PM +0800, kernel test robot wrote:
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> > > head: a160e1202ca318a85c70cf5831f172cc79a24c57
> > > commit: 846b4bacf2d48212f271fc1ef7488bcdf2c75bcb [7/12] usb: dwc3: core: Refactor PHY logic to support Multiport Controller
> > > config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240424/202404241215.Mib19Cu7-lkp@intel.com/config)
> > > compiler: s390-linux-gcc (GCC) 13.2.0
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240424/202404241215.Mib19Cu7-lkp@intel.com/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202404241215.Mib19Cu7-lkp@intel.com/
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > > drivers/usb/dwc3/core.c: In function 'dwc3_core_get_phy':
> > > > > drivers/usb/dwc3/core.c:1482:69: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Wformat-truncation=]
> > > 1482 | snprintf(phy_name, sizeof(phy_name), "usb2-%d", i);
> > > | ^~
> > > drivers/usb/dwc3/core.c:1482:63: note: directive argument in the range [-2147483641, 254]
> > > 1482 | snprintf(phy_name, sizeof(phy_name), "usb2-%d", i);
> >
> > This version or s390-build of gcc appears to be confused as the
> > variable i is clearly in the range [0,254] in these for loops.
> >
> > I also don't see this W=1 warning with my gcc-10 (aarch64).
> >
> > It may be possible to work around this by using u8 type for the iterator
> > (and %u in the format), but I'm not sure we should be working around
> > compiler bugs like that.
>
> Thanks Johan. i agree it looks like a bogus compiler warning, but I think
> your suggestion of changing to u8 should work, if only to placate the
> compiler.
>
> Greg, do you think I should go ahead and update it in v22 or can we ignore
> this warning ?
Please send a follow-on patch to fix this, I'll leave it as-is in my
tree for now.
thanks,
greg k-h
prev parent reply other threads:[~2024-04-25 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 5:03 [usb:usb-testing 7/12] drivers/usb/dwc3/core.c:1482:69: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 4 kernel test robot
2024-04-24 6:41 ` Johan Hovold
2024-04-25 5:08 ` Krishna Kurapati PSSNV
2024-04-25 15:18 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2024042510-jazz-send-be09@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=andersson@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=quic_kriskura@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).