From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dan Scally <dan.scally@ideasonboard.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] usb: gadget: configfs: Fix set but not used variable warning
Date: Fri, 10 Feb 2023 19:01:45 +0200 [thread overview]
Message-ID: <Y+Z4eeZTCDqzfu8C@smile.fi.intel.com> (raw)
In-Reply-To: <28381c7f-ec2b-621e-c441-20795689174f@ideasonboard.com>
On Fri, Feb 10, 2023 at 04:03:52PM +0000, Dan Scally wrote:
> On 10/02/2023 15:54, Andy Shevchenko wrote:
> > On Thu, Feb 09, 2023 at 09:43:59AM +0000, Daniel Scally wrote:
> > > Fix a -Wunused-but-set-variable warning in gadget_string_s_store()
> > A side comment below.
...
> > > if (len > USB_MAX_STRING_LEN)
> > > return -EINVAL;
> > > - ret = strscpy(string->string, page, size);
> > > - return len;
> > > + return strscpy(string->string, page, size);
> > Do you need above check with strscpy()? You may supply the maximum length
> > and negative error code from the strscpy() will indicate the cut.
> >
> It would still copy the truncated string in that case though, correct? Seems
> cleaner to me to just fail and leave the string as-is, but I don't
> particularly mind either way.
Good point. Yes, depending on the nature of the data we copy it (my proposal)
may or may not be a good idea.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2023-02-10 17:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 9:43 [PATCH] usb: gadget: configfs: Fix set but not used variable warning Daniel Scally
2023-02-10 15:54 ` Andy Shevchenko
2023-02-10 16:03 ` Dan Scally
2023-02-10 17:01 ` Andy Shevchenko [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=Y+Z4eeZTCDqzfu8C@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=dan.scally@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.