linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFC: fdp: Fix signedness bug in fdp_nci_send_patch
@ 2018-11-29  7:28 Wen Yang
  0 siblings, 0 replies; only message in thread
From: Wen Yang @ 2018-11-29  7:28 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, linux-kernel, zhong.weidong, Wen Yang

Currently, the error handling for the call to
nci_conn_max_data_pkt_payload_size() doesn't work
because *max_size* is of type u8 (8 bits, unsigned),
which makes it impossible for it to hold a value less
than 0.

Fix this by changing the type of variable *max_size*
to s16 (16 bits, signed).

since conn_info->max_pkt_payload_len is of type u8,
so s16 is enough.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
CC: Samuel Ortiz <sameo@linux.intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/nfc/fdp/fdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index d5784a47fc13..d9203e2468fd 100644
--- a/drivers/nfc/fdp/fdp.c
+++ b/drivers/nfc/fdp/fdp.c
@@ -192,7 +192,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;
+	s16 max_size, payload_size;
 	int rc = 0;
 
 	if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) ||
-- 
2.19.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-29  7:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29  7:28 [PATCH] NFC: fdp: Fix signedness bug in fdp_nci_send_patch Wen Yang

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).