All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] floppy: check_events callback should not return a negative number
@ 2019-01-28  9:06 ` Yufen Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-01-28  9:06 UTC (permalink / raw)
  To: axboe, osandov; +Cc: linux-block, kernel-janitors

Since .check_events interface return an unsigned int value,
floppy_check_events() should not return a negative error number.
Otherwise, disk_check_events() may process wiht an unexpected path.

fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 6f2856c6d0f2..55481b40df9a 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
 
 	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
 		if (lock_fdc(drive))
-			return -EINTR;
+			return 0;
 		poll_drive(false, 0);
 		process_fd_request();
 	}
-- 
2.16.2.dirty


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] floppy: check_events callback should not return a negative number
@ 2019-01-28  9:06 ` Yufen Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-01-28  9:06 UTC (permalink / raw)
  To: axboe, osandov; +Cc: linux-block, kernel-janitors

Since .check_events interface return an unsigned int value,
floppy_check_events() should not return a negative error number.
Otherwise, disk_check_events() may process wiht an unexpected path.

fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 6f2856c6d0f2..55481b40df9a 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
 
 	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
 		if (lock_fdc(drive))
-			return -EINTR;
+			return 0;
 		poll_drive(false, 0);
 		process_fd_request();
 	}
-- 
2.16.2.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
  2019-01-28  9:06 ` Yufen Yu
@ 2019-01-28  9:16   ` YueHaibing
  -1 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2019-01-28  9:16 UTC (permalink / raw)
  To: Yufen Yu, axboe, osandov; +Cc: linux-block, kernel-janitors

On 2019/1/28 17:06, Yufen Yu wrote:
> Since .check_events interface return an unsigned int value,
> floppy_check_events() should not return a negative error number.
> Otherwise, disk_check_events() may process wiht an unexpected path.

A typo, wiht --> with

> 
> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")

fixes should be Fixes

> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  drivers/block/floppy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 6f2856c6d0f2..55481b40df9a 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>  
>  	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>  		if (lock_fdc(drive))
> -			return -EINTR;
> +			return 0;
>  		poll_drive(false, 0);
>  		process_fd_request();
>  	}
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
@ 2019-01-28  9:16   ` YueHaibing
  0 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2019-01-28  9:16 UTC (permalink / raw)
  To: Yufen Yu, axboe, osandov; +Cc: linux-block, kernel-janitors

On 2019/1/28 17:06, Yufen Yu wrote:
> Since .check_events interface return an unsigned int value,
> floppy_check_events() should not return a negative error number.
> Otherwise, disk_check_events() may process wiht an unexpected path.

A typo, wiht --> with

> 
> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")

fixes should be Fixes

> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  drivers/block/floppy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 6f2856c6d0f2..55481b40df9a 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>  
>  	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>  		if (lock_fdc(drive))
> -			return -EINTR;
> +			return 0;
>  		poll_drive(false, 0);
>  		process_fd_request();
>  	}
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
  2019-01-28  9:06 ` Yufen Yu
@ 2019-01-28 13:19   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-01-28 13:19 UTC (permalink / raw)
  To: Yufen Yu; +Cc: axboe, osandov, linux-block, kernel-janitors

On Mon, Jan 28, 2019 at 05:06:46PM +0800, Yufen Yu wrote:
> Since .check_events interface return an unsigned int value,
> floppy_check_events() should not return a negative error number.
> Otherwise, disk_check_events() may process wiht an unexpected path.
> 
> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  drivers/block/floppy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 6f2856c6d0f2..55481b40df9a 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>  
>  	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>  		if (lock_fdc(drive))
> -			return -EINTR;
> +			return 0;

The patch is correct, but I wish the commit message had said what the
run time impact of the patch is.  Or sometimes it's hard to say what the
run time impact is, but it could have at least said why returning zero
is correct.  Say something like:

  floppy_check_events() is supposed to return bit flags to say which
  events occured.  We should return zero to say that no event flags are
  set.  Only BIT(0) and BIT(1) are used in the caller.  This code
  returns -4u  here so both BIT(0) and BIT(1) are clear.  So this patch
  shouldn't affect runtime, but it obviously is still worth fixing.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
@ 2019-01-28 13:19   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2019-01-28 13:19 UTC (permalink / raw)
  To: Yufen Yu; +Cc: axboe, osandov, linux-block, kernel-janitors

On Mon, Jan 28, 2019 at 05:06:46PM +0800, Yufen Yu wrote:
> Since .check_events interface return an unsigned int value,
> floppy_check_events() should not return a negative error number.
> Otherwise, disk_check_events() may process wiht an unexpected path.
> 
> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  drivers/block/floppy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 6f2856c6d0f2..55481b40df9a 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>  
>  	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>  		if (lock_fdc(drive))
> -			return -EINTR;
> +			return 0;

The patch is correct, but I wish the commit message had said what the
run time impact of the patch is.  Or sometimes it's hard to say what the
run time impact is, but it could have at least said why returning zero
is correct.  Say something like:

  floppy_check_events() is supposed to return bit flags to say which
  events occured.  We should return zero to say that no event flags are
  set.  Only BIT(0) and BIT(1) are used in the caller.  This code
  returns -4u  here so both BIT(0) and BIT(1) are clear.  So this patch
  shouldn't affect runtime, but it obviously is still worth fixing.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
  2019-01-28 13:19   ` Dan Carpenter
@ 2019-01-29  3:27     ` yuyufen
  -1 siblings, 0 replies; 8+ messages in thread
From: yuyufen @ 2019-01-29  3:27 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: axboe, osandov, linux-block, kernel-janitors



On 2019/1/28 21:19, Dan Carpenter wrote:
> On Mon, Jan 28, 2019 at 05:06:46PM +0800, Yufen Yu wrote:
>> Since .check_events interface return an unsigned int value,
>> floppy_check_events() should not return a negative error number.
>> Otherwise, disk_check_events() may process wiht an unexpected path.
>>
>> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
>> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
>> ---
>>   drivers/block/floppy.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
>> index 6f2856c6d0f2..55481b40df9a 100644
>> --- a/drivers/block/floppy.c
>> +++ b/drivers/block/floppy.c
>> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>>   
>>   	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>>   		if (lock_fdc(drive))
>> -			return -EINTR;
>> +			return 0;
> The patch is correct, but I wish the commit message had said what the
> run time impact of the patch is.  Or sometimes it's hard to say what the
> run time impact is, but it could have at least said why returning zero
> is correct.  Say something like:
>
>    floppy_check_events() is supposed to return bit flags to say which
>    events occured.  We should return zero to say that no event flags are
>    set.  Only BIT(0) and BIT(1) are used in the caller.  This code
>    returns -4u  here so both BIT(0) and BIT(1) are clear.  So this patch
>    shouldn't affect runtime, but it obviously is still worth fixing.

OK. Thanks a lot for your suggestion.

thanks,
Yufen

> regards,
> dan carpenter
>
> .
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] floppy: check_events callback should not return a negative number
@ 2019-01-29  3:27     ` yuyufen
  0 siblings, 0 replies; 8+ messages in thread
From: yuyufen @ 2019-01-29  3:27 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: axboe, osandov, linux-block, kernel-janitors



On 2019/1/28 21:19, Dan Carpenter wrote:
> On Mon, Jan 28, 2019 at 05:06:46PM +0800, Yufen Yu wrote:
>> Since .check_events interface return an unsigned int value,
>> floppy_check_events() should not return a negative error number.
>> Otherwise, disk_check_events() may process wiht an unexpected path.
>>
>> fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
>> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
>> ---
>>   drivers/block/floppy.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
>> index 6f2856c6d0f2..55481b40df9a 100644
>> --- a/drivers/block/floppy.c
>> +++ b/drivers/block/floppy.c
>> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>>   
>>   	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>>   		if (lock_fdc(drive))
>> -			return -EINTR;
>> +			return 0;
> The patch is correct, but I wish the commit message had said what the
> run time impact of the patch is.  Or sometimes it's hard to say what the
> run time impact is, but it could have at least said why returning zero
> is correct.  Say something like:
>
>    floppy_check_events() is supposed to return bit flags to say which
>    events occured.  We should return zero to say that no event flags are
>    set.  Only BIT(0) and BIT(1) are used in the caller.  This code
>    returns -4u  here so both BIT(0) and BIT(1) are clear.  So this patch
>    shouldn't affect runtime, but it obviously is still worth fixing.

OK. Thanks a lot for your suggestion.

thanks,
Yufen

> regards,
> dan carpenter
>
> .
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-29  3:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28  9:06 [PATCH] floppy: check_events callback should not return a negative number Yufen Yu
2019-01-28  9:06 ` Yufen Yu
2019-01-28  9:16 ` YueHaibing
2019-01-28  9:16   ` YueHaibing
2019-01-28 13:19 ` Dan Carpenter
2019-01-28 13:19   ` Dan Carpenter
2019-01-29  3:27   ` yuyufen
2019-01-29  3:27     ` yuyufen

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.