mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
NFC: fdp: Fix a signedness bug in fdp_nci_send_patch()
[ Upstream commit 0dcdf9f64028ec3b75db6b691560f8286f3898bf ]
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: a06347c04c ("NFC: Add Intel Fields Peak NFC solution driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
3d9cc478af
commit
3428faf70c
1 changed files with 2 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue