lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230330154703.36958-1-den-plotnikov@yandex-team.ru>
Date:   Thu, 30 Mar 2023 18:47:03 +0300
From:   Denis Plotnikov <den-plotnikov@...dex-team.ru>
To:     netdev@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, rajur@...lsio.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, den-plotnikov@...dex-team.ru
Subject: [PATCH] cxgb4: do conversion after string check

Static code analyzer complains to uncheck return value.
Indeed, the return value of kstrtouint "must be checked"
as the comment says.
Moreover, it looks like the string conversion  should be
after "end of string" or "new line" check.
This patch fixes these issues.

Signed-off-by: Denis Plotnikov <den-plotnikov@...dex-team.ru>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 14e0d989c3ba5..a8d3616630cc6 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -1576,9 +1576,11 @@ inval:				count = -EINVAL;
 		}
 		if (*word == '@') {
 			end = (char *)word + 1;
-			ret = kstrtouint(end, 10, &j);
 			if (*end && *end != '\n')
 				goto inval;
+			ret = kstrtouint(end, 10, &j);
+			if (ret)
+				goto inval;
 			if (j & 7)          /* doesn't start at multiple of 8 */
 				goto inval;
 			j /= 8;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ