mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arnd Bergmann" <arnd@kernel.org>
Cc: "Udipto Goswami" <quic_ugoswami@quicinc.com>,
	"John Keeping" <john@keeping.me.uk>,
	"Linyu Yuan" <quic_linyyuan@quicinc.com>,
	"Dan Carpenter" <error27@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: functionfs: avoid memcpy() field overflow warning
Date: Mon, 03 Jul 2023 15:05:14 +0200	[thread overview]
Message-ID: <8af6715a-8dc9-4cd4-9a83-acc27e539c54@app.fastmail.com> (raw)
In-Reply-To: <2023070309-outlook-predator-c3dc@gregkh>

On Mon, Jul 3, 2023, at 14:45, Greg Kroah-Hartman wrote:
> On Mon, Jul 03, 2023 at 02:30:32PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> __ffs_func_bind_do_os_desc() copies both the CompatibleID and SubCompatibleID
>> fields of the usb_ext_compat_desc structure into an array, which triggers
>> a warning in the fortified memcpy():
>> 
>> In file included from drivers/usb/gadget/function/f_fs.c:17:
>> In file included from include/linux/string.h:254:
>> include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
>>                         __read_overflow2_field(q_size_field, size);
>> 
>> Usually we can avoid this by using a struct_group() inside of the structure
>> definition, but this might cause problems in userspace since it is in a uapi
>> header.
>
> We use this in other uapi .h files, what is unique about these fields
> that makes it so that they can not be used?  Because it's not the last
> field?

It's probably ok, and I was overly cautious. I'll send a new version after
some more testing.

       Arnd

      reply	other threads:[~2023-07-03 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 12:30 Arnd Bergmann
2023-07-03 12:45 ` Greg Kroah-Hartman
2023-07-03 13:05   ` Arnd Bergmann [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=8af6715a-8dc9-4cd4-9a83-acc27e539c54@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john@keeping.me.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_linyyuan@quicinc.com \
    --cc=quic_ugoswami@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

all inboxes | Powered by JetHome®