* [PATCH -next] mtip32xx: fix potential NULL pointer dereference in mtip_timeout_function()
@ 2012-11-08 9:35 Wei Yongjun
2012-11-08 11:51 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-11-08 9:35 UTC (permalink / raw)
To: axboe, smani; +Cc: yongjun_wei, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
The dereference to port should be moved below the NULL test.
dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/block/mtip32xx/mtip32xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index adc6f36..fe16b32 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -559,7 +559,7 @@ static void mtip_timeout_function(unsigned long int data)
struct mtip_cmd *command;
int tag, cmdto_cnt = 0;
unsigned int bit, group;
- unsigned int num_command_slots = port->dd->slot_groups * 32;
+ unsigned int num_command_slots;
unsigned long to, tagaccum[SLOTBITS_IN_LONGS];
if (unlikely(!port))
@@ -572,6 +572,7 @@ static void mtip_timeout_function(unsigned long int data)
}
/* clear the tag accumulator */
memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
+ num_command_slots = port->dd->slot_groups * 32;
for (tag = 0; tag < num_command_slots; tag++) {
/*
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-08 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 9:35 [PATCH -next] mtip32xx: fix potential NULL pointer dereference in mtip_timeout_function() Wei Yongjun
2012-11-08 11:51 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.