summaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-03-20 14:21:17 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-24 05:05:13 +0100
commit0dcdf9f64028ec3b75db6b691560f8286f3898bf (patch)
treef4c63d1d07996645851f6406368ba4e7d7e1084b /drivers/nfc
parentipv4: fix a RCU-list lock in inet_dump_fib() (diff)
downloadlinux-0dcdf9f64028ec3b75db6b691560f8286f3898bf.tar.xz
linux-0dcdf9f64028ec3b75db6b691560f8286f3898bf.zip
NFC: fdp: Fix a signedness bug in fdp_nci_send_patch()
The nci_conn_max_data_pkt_payload_size() function sometimes returns -EPROTO so "max_size" needs to be signed for the error handling to work. We can make "payload_size" an int as well. Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/fdp/fdp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index 0cc9ac856fe2..ed2123129e0e 100644
--- a/drivers/nfc/fdp/fdp.c
+++ b/drivers/nfc/fdp/fdp.c
@@ -184,7 +184,7 @@ 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 max_size, payload_size;
int rc = 0;
if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) ||
@@ -207,8 +207,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
while (len) {
- payload_size = min_t(unsigned long, (unsigned long) max_size,
- len);
+ payload_size = min_t(unsigned long, max_size, len);
skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size),
GFP_KERNEL);