Skip to content

Commit

Permalink
staging/sep: Fix smatch false positive about potential NULL dereferen…
Browse files Browse the repository at this point in the history
…ce in sep_main.c

Smatch complains about a potential NULL pointer dereference:

sep_main.c:2312 sep_construct_dma_tables_from_lli() error: potential
NULL dereference 'info_out_entry_ptr'.

info_out_entry_ptr is initialized with NULL and if info_in_entry_ptr is
not NULL it gets derefenced.
However info_out_entry_ptr is only NULL in the first iteration of the
while loop and in this case info_in_entry_ptr is also NULL (as indicated
by the comment /* If info entry is null - this is the first table built */
-> this is a false positive.

Nevertheless we add a check for info_out_entry_ptr to silence this
warning and make it more robust in regard to code changes.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Huewe authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent 7791c62 commit c37aeab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/sep/sep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2276,7 +2276,7 @@ static int sep_construct_dma_tables_from_lli(
table_data_size);

/* If info entry is null - this is the first table built */
if (info_in_entry_ptr == NULL) {
if (info_in_entry_ptr == NULL || info_out_entry_ptr == NULL) {
/* Set the output parameters to physical addresses */
*lli_table_in_ptr =
sep_shared_area_virt_to_bus(sep, dma_in_lli_table_ptr);
Expand Down

0 comments on commit c37aeab

Please sign in to comment.