On Thu, Aug 05, 2021 at 01:37:13PM -0500, Larry Finger wrote: > diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c > index 4ac76ca6e383..d7d33e201f37 100644 > --- a/drivers/staging/r8188eu/core/rtw_cmd.c > +++ b/drivers/staging/r8188eu/core/rtw_cmd.c > @@ -1947,10 +1947,13 @@ static void c2h_wk_callback(struct work_struct *work) > if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) { > /* This C2H event is read, clear it */ > c2h_evt_clear(adapter); > - } else if ((c2h_evt = (struct c2h_evt_hdr *)rtw_malloc(16)) != NULL) { > - /* This C2H event is not read, read & clear now */ > - if (c2h_evt_read(adapter, (u8 *)c2h_evt) != _SUCCESS) > - continue; > + } else { > + c2h_evt = kmalloc(16, GFP_KERNEL); > + if (c2h_evt) { > + /* This C2H event is not read, read & clear now */ > + if (c2h_evt_read(adapter, (u8 *)c2h_evt) != _SUCCESS) > + continue; Not related to your patch (don't resend, please fix this in a follow on patch if you want to) but this isn't correct. If the allocation fails, it leads to a NULL dereference. Or if the c2h_evt_read() call fails there needs to be a kfree(c2h_evt) before the continue. > + } > } > regards, dan carpenter