Skip to content

Commit

Permalink
ocxl: fix signed comparison with less than zero
Browse files Browse the repository at this point in the history
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: 5ef3166 ("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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Colin Ian King authored and Michael Ellerman committed Feb 8, 2018
1 parent 6cc3f91 commit dedab7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/misc/ocxl/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit dedab7f

Please sign in to comment.