* [PATCH] NFC: fdp: fix signed less or equal zero check in u8 max_size
@ 2018-01-30 15:33 Colin King
2018-06-04 4:18 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-01-30 15:33 UTC (permalink / raw)
To: Samuel Ortiz, David S . Miller, Johannes Berg, linux-wireless
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The u8 variable max_size is being assigned a return value from the
call to nci_conn_max_data_pkt_payload_size that can return a -ve
error return. Since max_size is a u8, the -ve check for the error will
always be false. Fix this by making max_size an int type.
Detected using Coccinelle:
drivers/nfc/fdp/fdp.c:208:5-13: WARNING: Unsigned expression compared
with zero: max_size <= 0
Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/nfc/fdp/fdp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index d5784a47fc13..5ddc01b4913a 100644
--- a/drivers/nfc/fdp/fdp.c
+++ b/drivers/nfc/fdp/fdp.c
@@ -192,8 +192,8 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
const struct firmware *fw;
struct sk_buff *skb;
unsigned long len;
- u8 max_size, payload_size;
- int rc = 0;
+ u8 payload_size;
+ int max_size, rc = 0;
if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) ||
(type == NCI_PATCH_TYPE_RAM && !info->ram_patch))
--
2.15.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] NFC: fdp: fix signed less or equal zero check in u8 max_size
2018-01-30 15:33 [PATCH] NFC: fdp: fix signed less or equal zero check in u8 max_size Colin King
@ 2018-06-04 4:18 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2018-06-04 4:18 UTC (permalink / raw)
To: Colin King
Cc: David S . Miller, Johannes Berg, linux-wireless, kernel-janitors,
linux-kernel
Hi Colin,
On Tue, Jan 30, 2018 at 03:33:59PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The u8 variable max_size is being assigned a return value from the
> call to nci_conn_max_data_pkt_payload_size that can return a -ve
> error return. Since max_size is a u8, the -ve check for the error will
> always be false. Fix this by making max_size an int type.
>
> Detected using Coccinelle:
> drivers/nfc/fdp/fdp.c:208:5-13: WARNING: Unsigned expression compared
> with zero: max_size <= 0
>
> Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/nfc/fdp/fdp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to nfc-next, thanks.
Cheers,
Samuel.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-04 4:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 15:33 [PATCH] NFC: fdp: fix signed less or equal zero check in u8 max_size Colin King
2018-06-04 4:18 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®