NULL pointer dereference in drivers/message/i2o/i2o_config.c
PATCH 1/1 NULL pointer dereference in drivers/message/i2o/i2o_config.c
hi,
i am not sure if there is some black magic which prevents this from happening, it is spotted by coverity id #265
499 for (p = open_files; p; p = p->next) 500 if (p->q_id == (ulong) fp->private_data) 501 break; 502 503 if (!p->q_len) 504 return -ENOENT
if we cant find a p with a p->q_id which matches fp->private data, we dereference it.
Signed-off-by Eric Sesterhenn <[email protected]>
drivers/message/i2o/i2o_config.c renamed from drivers/message/i2o/i2o_config.c.orig +1 -1
@@ -500,7 +500,7 @@ static int i2o_cfg_evt_get(unsigned longif (p->q_id == (ulong ) fp->private_data)break ; -if (!p->q_len) +if (!p || !p->q_len)return -ENOENT ;memcpy (&kget.info, &p->event_q[p->q_out],sizeof (struct i2o_evt_info ));