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

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

From: Kumar, M Chetan <hidden>
Date: 2021-08-16 10:48:24

Hi Dan,
quoted hunk ↗ jump to hunk
+++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c
@@ -64,10 +64,9 @@ static struct ipc_chnl_cfg modem_cfg[] = {

 int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index)  {
-	int array_size = ARRAY_SIZE(modem_cfg);
-
-	if (index >= array_size) {
-		pr_err("index: %d and array_size %d", index, array_size);
+	if (index >= ARRAY_SIZE(modem_cfg)) {
+		pr_err("index: %d and array_size %lu", index,
array_size is removed so please change array_size in pr_err to array size (remove _).

Also change in pr_err array size format "%lu" is throwing warning [1] in 32bit env.

[1]
                 from ../drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c:6:
../drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c: In function 'ipc_chnl_cfg_get':
../include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type
 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat=]

Regards,
Chetan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help