async->cmd = user_cmd;
async->cmd.data = NULL;
/* load channel/gain list */
- async->cmd.chanlist =
- kmalloc(async->cmd.chanlist_len * sizeof(int), GFP_KERNEL);
+ if (async->cmd.chanlist_len <= ULONG_MAX / sizeof(int))
+ async->cmd.chanlist =
+ kmalloc(async->cmd.chanlist_len * sizeof(int),
+ GFP_KERNEL);
+ else
+ async->cmd.chanlist = NULL;
if (!async->cmd.chanlist) {
DPRINTK("allocation failed\n");
ret = -ENOMEM;
/* load channel/gain list */
if (user_cmd.chanlist) {
- chanlist =
- kmalloc(user_cmd.chanlist_len * sizeof(int),
- GFP_KERNEL);
+ if (user_cmd.chanlist_len <= ULONG_MAX / sizeof(int))
+ chanlist =
+ kmalloc(user_cmd.chanlist_len * sizeof(int),
+ GFP_KERNEL);
if (!chanlist) {
DPRINTK("allocation failed\n");
ret = -ENOMEM;