Skip to content

Commit

Permalink
cxgb4: correctly handling failed allocation
Browse files Browse the repository at this point in the history
Since t4_alloc_mem can be failed in memory pressure,
if not properly handled, NULL dereference could be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Insu Yun authored and David S. Miller committed Jan 4, 2016
1 parent b77357b commit 3934aa4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
INIT_LIST_HEAD(&ctbl->hash_list[i]);

cl_list = t4_alloc_mem(clipt_size*sizeof(struct clip_entry));
if (!cl_list) {
t4_free_mem(ctbl);
return NULL;
}
ctbl->cl_list = (void *)cl_list;

for (i = 0; i < clipt_size; i++) {
Expand Down

0 comments on commit 3934aa4

Please sign in to comment.