From: Kent Gibson <warthog618@gmail.com>
To: Gabriel Knezek <gabeknez@linux.microsoft.com>
Cc: linux-gpio@vger.kernel.org,
Gabriel Knezek <gabeknez@microsoft.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH] gpiolib: cdev: zero padding during conversion to gpioline_info_changed
Date: Sat, 19 Jun 2021 12:11:44 +0800 [thread overview]
Message-ID: <20210619041144.GA15015@sol> (raw)
In-Reply-To: <1624056311-6836-1-git-send-email-gabeknez@linux.microsoft.com>
On Fri, Jun 18, 2021 at 03:45:11PM -0700, Gabriel Knezek wrote:
Probably should've been [PATCH v2], despite the subject rename.
And CC the maintainers (LinusW and Bart here) and past reviewers (Andy
and me).
> From: Gabriel Knezek <gabeknez@microsoft.com>
>
A second From: header? With a different address?
Perhaps you could pick one?
Neither git nor checkpatch.pl seem to mind, but it is odd.
> When userspace requests a GPIO v1 line info changed event, the kernel
> populates and returns the gpioline_info_changed structure. That structure
> contains 5 words of padding at the end of the structure that are not
> initialized before being returned to usermode:
>
Avoid code snippets in checkin comments - try to stick to plain English.
So replace "the kernel" with "lineinfo_watch_read()" and drop the
snippets.
And "usermode" -> "userspace".
> struct gpioline_info_changed {
> struct gpioline_info info;
> __u64 timestamp;
> __u32 event_type;
> __u32 padding[5]; /* for future use */
> };
>
> Which is used here in the lineinfo_watch_read routine:
> } else {
> struct gpioline_info_changed event_v1;
> gpio_v2_line_info_changed_to_v1(&event, &event_v1);
> if (copy_to_user(buf + bytes_read, &event_v1,
> event_size))
> return -EFAULT;
>
> Fix this by zeroing the structure in gpio_v2_line_info_change_to_v1
> before populating its contents.
>
Make that "gpio_v2_line_info_change_to_v1()" as you are referring to a
function.
And maybe "Fix this by zeroing" to just "Zero"?
> Signed-off-by: Gabriel Knezek <gabeknez@microsoft.com>
You should retain the Fixes tag from v1 - it is important to identify
where this patch will need to be backported to.
And include at least the first twelve characters of the SHA-1 [1].
> ---
> drivers/gpio/gpiolib-cdev.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> index ee5903aac497..af68532835fe 100644
> --- a/drivers/gpio/gpiolib-cdev.c
> +++ b/drivers/gpio/gpiolib-cdev.c
> @@ -1865,6 +1865,7 @@ static void gpio_v2_line_info_changed_to_v1(
> struct gpio_v2_line_info_changed *lic_v2,
> struct gpioline_info_changed *lic_v1)
> {
> + memset(lic_v1, 0, sizeof(*lic_v1));
> gpio_v2_line_info_to_v1(&lic_v2->info, &lic_v1->info);
> lic_v1->timestamp = lic_v2->timestamp_ns;
> lic_v1->event_type = lic_v2->event_type;
> --
> 2.25.1
>
Still good with this bit ;)
Cheers,
Kent.
[1] https://www.kernel.org/doc/html/v5.12/process/submitting-patches.html
next prev parent reply other threads:[~2021-06-19 4:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 22:45 [PATCH] gpiolib: cdev: zero padding during conversion to gpioline_info_changed Gabriel Knezek
2021-06-19 4:11 ` Kent Gibson [this message]
2021-06-19 17:49 ` Gabriel Knezek
2021-06-19 20:08 ` Andy Shevchenko
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=20210619041144.GA15015@sol \
--to=warthog618@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=gabeknez@linux.microsoft.com \
--cc=gabeknez@microsoft.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/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.