* re: raid5: offload stripe handle to workqueue
@ 2014-07-15 15:49 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-07-15 15:49 UTC (permalink / raw)
To: shli; +Cc: linux-raid
Hello Shaohua Li,
The patch 851c30c9badf: "raid5: offload stripe handle to workqueue"
from Aug 28, 2013, leads to the following static checker warning:
drivers/md/raid5.c:5554 alloc_thread_groups()
warn: integer overflows in allocation
drivers/md/raid5.c
5537 static int alloc_thread_groups(struct r5conf *conf, int cnt,
^^^^^^^
"cnt" comes from the user as an unsigned long in
raid5_store_group_thread_cnt() but we truncate it to int here. It would
be cleaner if the types were the same through out.
5538 int *group_cnt,
5539 int *worker_cnt_per_group,
5540 struct r5worker_group **worker_groups)
5541 {
5542 int i, j, k;
5543 ssize_t size;
5544 struct r5worker *workers;
5545
5546 *worker_cnt_per_group = cnt;
5547 if (cnt == 0) {
5548 *group_cnt = 0;
5549 *worker_groups = NULL;
5550 return 0;
5551 }
5552 *group_cnt = num_possible_nodes();
5553 size = sizeof(struct r5worker) * cnt;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Integer overflow #1.
5554 workers = kzalloc(size * *group_cnt, GFP_NOIO);
^^^^^^^^^^^^^^^^^
Integer overflow #2.
5555 *worker_groups = kzalloc(sizeof(struct r5worker_group) *
5556 *group_cnt, GFP_NOIO);
TODO-list: 2014-07-14: raid5: integer overflows in alloc_thread_groups()
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-07-15 15:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15 15:49 raid5: offload stripe handle to workqueue Dan Carpenter
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.