Skip to content

Commit 0dcdf9f

Browse files
Dan Carpenterdavem330
authored andcommitted
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: a06347c ("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>
1 parent dddeb30 commit 0dcdf9f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/nfc/fdp/fdp.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
184184
const struct firmware *fw;
185185
struct sk_buff *skb;
186186
unsigned long len;
187-
u8 max_size, payload_size;
187+
int max_size, payload_size;
188188
int rc = 0;
189189

190190
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)
207207

208208
while (len) {
209209

210-
payload_size = min_t(unsigned long, (unsigned long) max_size,
211-
len);
210+
payload_size = min_t(unsigned long, max_size, len);
212211

213212
skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size),
214213
GFP_KERNEL);

0 commit comments

Comments
 (0)