[PATCH 13/22] crypto: ecc: fix clang-analyzer warning about NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



clang-analyzer believes that point->x can dereference a NULL pointer.
I suspect that's not possible, because of the arguments the function is
called with, but let's play it safe and assert that point is non-NULL
before dereferencing.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 crypto/ecc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/ecc.c b/crypto/ecc.c
index a0ab962262ca..d91948bddbde 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -1434,6 +1434,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result,
 	idx |= (!!vli_test_bit(u2, i)) << 1;
 	point = points[idx];
 
+	BUG_ON(!point);
+
 	vli_set(rx, point->x, ndigits);
 	vli_set(ry, point->y, ndigits);
 	vli_clear(z + 1, ndigits - 1);
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux