Thread (5 messages) flat view 5 messages, 3 authors, 2021-08-16

RE: [PATCH v2 net] net: iosm: Prevent underflow in ipc_chnl_cfg_get()

From: Kumar, M Chetan <hidden>
Date: 2021-08-16 12:17:28

-----Original Message-----
From: Dan Carpenter <redacted>
Sent: Monday, August 16, 2021 4:44 PM
To: Kumar, M Chetan <redacted>; Solomon Ucko
[off-list ref]
Cc: linuxwwan <redacted>; Loic Poulain
[off-list ref]; Sergey Ryazanov [off-list ref];
Johannes Berg [off-list ref]; David S. Miller
[off-list ref]; Jakub Kicinski [off-list ref];
netdev@vger.kernel.org; security@kernel.org
Subject: [PATCH v2 net] net: iosm: Prevent underflow in ipc_chnl_cfg_get()

The bounds check on "index" doesn't catch negative values.  Using
ARRAY_SIZE() directly is more readable and more robust because it prevents
negative values for "index".  Fortunately we only pass valid values to
ipc_chnl_cfg_get() so this patch does not affect runtime.


Reported-by: Solomon Ucko <redacted>
Signed-off-by: Dan Carpenter <redacted>
---
v2: Remove underscore between "array" and "size".
    Use %zu print format specifier to fix a compile warning on 32 bit.

 drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Reviewed-by: M Chetan Kumar <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help