* [PATCH] ocxl: fix signed comparison with less than zero
@ 2018-01-30 15:11 Colin King
2018-01-30 23:42 ` Andrew Donnellan
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Colin King @ 2018-01-30 15:11 UTC (permalink / raw)
To: Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, linuxppc-dev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the comparison of used < 0 is always false because
uses is a size_t. Fix this by making used a ssize_t type.
Detected by Coccinelle:
drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
compared with zero: used < 0
Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/misc/ocxl/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index c90c1a578d2f..1287e4430e6b 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
struct ocxl_context *ctx = file->private_data;
struct ocxl_kernel_event_header header;
ssize_t rc;
- size_t used = 0;
+ ssize_t used = 0;
DEFINE_WAIT(event_wait);
memset(&header, 0, sizeof(header));
--
2.15.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ocxl: fix signed comparison with less than zero
2018-01-30 15:11 [PATCH] ocxl: fix signed comparison with less than zero Colin King
@ 2018-01-30 23:42 ` Andrew Donnellan
2018-01-31 12:57 ` Frederic Barrat
2018-02-09 4:00 ` Michael Ellerman
2 siblings, 0 replies; 7+ messages in thread
From: Andrew Donnellan @ 2018-01-30 23:42 UTC (permalink / raw)
To: Colin King, Frederic Barrat, Arnd Bergmann, Greg Kroah-Hartman,
linuxppc-dev
Cc: kernel-janitors, linux-kernel
On 31/01/18 02:11, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks for picking this up!
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
> drivers/misc/ocxl/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index c90c1a578d2f..1287e4430e6b 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
> struct ocxl_context *ctx = file->private_data;
> struct ocxl_kernel_event_header header;
> ssize_t rc;
> - size_t used = 0;
> + ssize_t used = 0;
> DEFINE_WAIT(event_wait);
>
> memset(&header, 0, sizeof(header));
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ocxl: fix signed comparison with less than zero
@ 2018-01-30 23:42 ` Andrew Donnellan
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Donnellan @ 2018-01-30 23:42 UTC (permalink / raw)
To: Colin King, Frederic Barrat, Arnd Bergmann, Greg Kroah-Hartman,
linuxppc-dev
Cc: kernel-janitors, linux-kernel
On 31/01/18 02:11, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks for picking this up!
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
> drivers/misc/ocxl/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index c90c1a578d2f..1287e4430e6b 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
> struct ocxl_context *ctx = file->private_data;
> struct ocxl_kernel_event_header header;
> ssize_t rc;
> - size_t used = 0;
> + ssize_t used = 0;
> DEFINE_WAIT(event_wait);
>
> memset(&header, 0, sizeof(header));
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ocxl: fix signed comparison with less than zero
2018-01-30 15:11 [PATCH] ocxl: fix signed comparison with less than zero Colin King
@ 2018-01-31 12:57 ` Frederic Barrat
2018-01-31 12:57 ` Frederic Barrat
2018-02-09 4:00 ` Michael Ellerman
2 siblings, 0 replies; 7+ messages in thread
From: Frederic Barrat @ 2018-01-31 12:57 UTC (permalink / raw)
To: Colin King, Andrew Donnellan, Arnd Bergmann, Greg Kroah-Hartman,
linuxppc-dev
Cc: kernel-janitors, linux-kernel
Le 30/01/2018 à 16:11, Colin King a écrit :
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
Thanks!
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> drivers/misc/ocxl/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index c90c1a578d2f..1287e4430e6b 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
> struct ocxl_context *ctx = file->private_data;
> struct ocxl_kernel_event_header header;
> ssize_t rc;
> - size_t used = 0;
> + ssize_t used = 0;
> DEFINE_WAIT(event_wait);
>
> memset(&header, 0, sizeof(header));
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ocxl: fix signed comparison with less than zero
@ 2018-01-31 12:57 ` Frederic Barrat
0 siblings, 0 replies; 7+ messages in thread
From: Frederic Barrat @ 2018-01-31 12:57 UTC (permalink / raw)
To: Colin King, Andrew Donnellan, Arnd Bergmann, Greg Kroah-Hartman,
linuxppc-dev
Cc: kernel-janitors, linux-kernel
Le 30/01/2018 à 16:11, Colin King a écrit :
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
Thanks!
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> drivers/misc/ocxl/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index c90c1a578d2f..1287e4430e6b 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
> struct ocxl_context *ctx = file->private_data;
> struct ocxl_kernel_event_header header;
> ssize_t rc;
> - size_t used = 0;
> + ssize_t used = 0;
> DEFINE_WAIT(event_wait);
>
> memset(&header, 0, sizeof(header));
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ocxl: fix signed comparison with less than zero
2018-01-30 15:11 [PATCH] ocxl: fix signed comparison with less than zero Colin King
@ 2018-02-09 4:00 ` Michael Ellerman
2018-01-31 12:57 ` Frederic Barrat
2018-02-09 4:00 ` Michael Ellerman
2 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2018-02-09 4:00 UTC (permalink / raw)
To: Colin King, Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, linuxppc-dev
Cc: kernel-janitors, linux-kernel
On Tue, 2018-01-30 at 15:11:44 UTC, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/dedab7f0d3137441a97fe7cf9b9ca5
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ocxl: fix signed comparison with less than zero
@ 2018-02-09 4:00 ` Michael Ellerman
0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2018-02-09 4:00 UTC (permalink / raw)
To: Colin King, Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, linuxppc-dev
Cc: kernel-janitors, linux-kernel
On Tue, 2018-01-30 at 15:11:44 UTC, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the comparison of used < 0 is always false because
> uses is a size_t. Fix this by making used a ssize_t type.
>
> Detected by Coccinelle:
> drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression
> compared with zero: used < 0
>
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/dedab7f0d3137441a97fe7cf9b9ca5
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-02-09 4:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 15:11 [PATCH] ocxl: fix signed comparison with less than zero Colin King
2018-01-30 23:42 ` Andrew Donnellan
2018-01-30 23:42 ` Andrew Donnellan
2018-01-31 12:57 ` Frederic Barrat
2018-01-31 12:57 ` Frederic Barrat
2018-02-09 4:00 ` Michael Ellerman
2018-02-09 4:00 ` Michael Ellerman
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.