* [PATCH net] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch()
@ 2020-03-20 13:21 Dan Carpenter
2020-03-24 4:05 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-03-20 13:21 UTC (permalink / raw)
To: Kate Stewart, Robert Dolca
Cc: Greg Kroah-Hartman, Gustavo A. R. Silva, Samuel Ortiz, netdev,
kernel-janitors
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>
---
drivers/nfc/fdp/fdp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index 7c0b1e6b80ff..4dc7bd7e02b6 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);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch()
2020-03-20 13:21 [PATCH net] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() Dan Carpenter
@ 2020-03-24 4:05 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-03-24 4:05 UTC (permalink / raw)
To: dan.carpenter
Cc: kstewart, robert.dolca, gregkh, gustavo, sameo, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 20 Mar 2020 16:21:17 +0300
> 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>
Applied and queued up for -stable, thanks Dan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-24 4:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 13:21 [PATCH net] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() Dan Carpenter
2020-03-24 4:05 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).