aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-01-30 15:33:59 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2018-06-04 06:16:02 +0200
commite530d198bdbfe59b5c99ee48287e81f893326731 (patch)
treeae078e1555683dab3f3e7cdee4325116ec729385
parentf624434a0ec96ac338f10f3f7f5a2ef287dd597e (diff)
downloadnfc-next-e530d198bdbfe59b5c99ee48287e81f893326731.tar.gz
NFC: fdp: fix signed less or equal zero check in u8 max_size
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> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/fdp/fdp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index d5784a47fc1309..5ddc01b4913ae1 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))