* [PATCH] gpiolib: cdev: convert stream-like files from
@ 2021-02-07 9:00 Yang Li
2021-02-08 5:58 ` Bartosz Golaszewski
2021-02-12 9:00 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2021-02-07 9:00 UTC (permalink / raw)
To: linus.walleij; +Cc: bgolaszewski, linux-gpio, linux-kernel, Yang Li
Eliminate the following coccicheck warning:
./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read()
has stream semantic; safe to change nonseekable_open -> stream_open.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/gpio/gpiolib-cdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 1631727..bad68ef 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -2304,7 +2304,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)
get_device(&gdev->dev);
file->private_data = cdev;
- ret = nonseekable_open(inode, file);
+ ret = stream_open(inode, file);
if (ret)
goto out_unregister_notifier;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpiolib: cdev: convert stream-like files from
2021-02-07 9:00 [PATCH] gpiolib: cdev: convert stream-like files from Yang Li
@ 2021-02-08 5:58 ` Bartosz Golaszewski
2021-02-12 9:00 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2021-02-08 5:58 UTC (permalink / raw)
To: Yang Li, Kent Gibson; +Cc: Linus Walleij, linux-gpio, LKML
On Sun, Feb 7, 2021 at 10:00 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> Eliminate the following coccicheck warning:
> ./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read()
> has stream semantic; safe to change nonseekable_open -> stream_open.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
> drivers/gpio/gpiolib-cdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> index 1631727..bad68ef 100644
> --- a/drivers/gpio/gpiolib-cdev.c
> +++ b/drivers/gpio/gpiolib-cdev.c
> @@ -2304,7 +2304,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)
> get_device(&gdev->dev);
> file->private_data = cdev;
>
> - ret = nonseekable_open(inode, file);
> + ret = stream_open(inode, file);
> if (ret)
> goto out_unregister_notifier;
>
> --
> 1.8.3.1
>
I think you have a false positive here - we don't even take the offset
argument into account so I don't see how the line_watch_read callback
could be interpreted as seekable.
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpiolib: cdev: convert stream-like files from
2021-02-07 9:00 [PATCH] gpiolib: cdev: convert stream-like files from Yang Li
2021-02-08 5:58 ` Bartosz Golaszewski
@ 2021-02-12 9:00 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-02-12 9:00 UTC (permalink / raw)
To: Yang Li; +Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, linux-kernel
On Sun, Feb 7, 2021 at 10:00 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
> Eliminate the following coccicheck warning:
> ./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read()
> has stream semantic; safe to change nonseekable_open -> stream_open.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
This doesn't make any sense to me.
It is pretty clear from context that this file should *not* be
seeked and it seems just dangerous to randomly allow that.
Better safe than sorry.
I don't know if the function nonseekable_open() has an unintuitive
name if it means anything else than that. I burnt myself on the FS
before.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-12 9:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 9:00 [PATCH] gpiolib: cdev: convert stream-like files from Yang Li
2021-02-08 5:58 ` Bartosz Golaszewski
2021-02-12 9:00 ` Linus Walleij
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 NNTP newsgroup(s).