lkml.org 
[lkml]   [2015]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH next] staging: wilc1000: avoid NULL pointer dereference on error
On Wed, Oct 07, 2015 at 07:08:25AM +0200, Vincent Stehlé wrote:
> drivers/staging/wilc1000/host_interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 2cf82b2..2fe3023 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -6017,7 +6017,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
> pstrWFIDrv = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
> if (!pstrWFIDrv) {
> result = -ENOMEM;
> - goto _fail_timer_2;
> + goto _fail_;

Fair enough. I would have prefered a direct return, but his also works.

The error handling in this function is still very bad and nonsensical.
You have fixed the first goto but all the others are buggy as well.

if add_handler_in_list() fails we should "goto free_pstrWFIDrv" (except
the label name should have Hungarian notation or CamelCase). Instead of
freeing the current code unlocks a lock which is not initialiazed and
frees some timers which are also not initialized.

TODO: wilc1000: fix error handling in host_int_init()

regards,
dan carpenter




\
 
 \ /
  Last update: 2015-10-07 08:41    [W:0.073 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site