summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRashika Kheria <rashika.kheria@gmail.com>2013-10-24 10:54:51 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-28 21:22:20 (GMT)
commit9c7bc37628d8edef821176fcd7872efd54358f50 (patch)
treeeb7587bb2f23e3fb727de57acec3ad97852d4416
parent800df1a5b3cbb25615f37a2f80a38210a3e9db9b (diff)
downloadlinux-fsl-qoriq-9c7bc37628d8edef821176fcd7872efd54358f50.tar.xz
Staging: et131x: Fix Smatch Warning of Buffer Overflow
This patch fixes the following Sparse Warning in et131x.c- drivers/staging/et131x/et131x.c:2957 nic_send_packet() error: buffer overflow 'frags' 17 <= 21 drivers/staging/et131x/et131x.c:2959 nic_send_packet() warn: buffer overflow 'frags' 17 <= 21 drivers/staging/et131x/et131x.c:2961 nic_send_packet() error: buffer overflow 'frags' 17 <= 21 Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/et131x/et131x.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 7cd3d34..d9446c4 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2902,8 +2902,9 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
* number of fragments. If needed, we can call this function,
* although it is less efficient.
*/
- if (nr_frags > 23)
- return -EIO;
+
+ /* nr_frags should be no more than 18. */
+ BUILD_BUG_ON(MAX_SKB_FRAGS + 1 > 23);
memset(desc, 0, sizeof(struct tx_desc) * (nr_frags + 1));