Re: [PATCH v2] staging: r8188eu: Use kzalloc() with GFP_ATOMIC in atomic context
From: Fabio M. De Francesco
Date: Mon Nov 01 2021 - 12:30:54 EST
On Monday, November 1, 2021 4:11:26 PM CET Larry Finger wrote:
> On 11/1/21 09:27, Fabio M. De Francesco wrote:
> > Use the GFP_ATOMIC flag of kzalloc() with two memory allocation in
> > report_del_sta_event(). This function is called while holding spinlocks,
> > therefore it is not allowed to sleep. With the GFP_ATOMIC type flag, the
> > allocation is high priority and must not sleep.
> >
> > This issue is detected by Smatch which emits the following warning:
> > "drivers/staging/r8188eu/core/rtw_mlme_ext.c:6848 report_del_sta_event()
> > warn: sleeping in atomic context".
> >
> > []
> >
> I am happy that you caught the error before it destroyed every instance of
> r8188eu.
I don't think so, since we have run this driver with no problems at all :)
SAC bugs can potentially cause serious system hangs at runtime, but they do
not always cause problems in real execution as you have noticed here with
this driver. We have used and tested it hundreds of times with no problems.
> Incidentally, I disagree with checkpatch in that I think that
> sizeof(struct foo) is more descriptive than sizeof(*bar).
I agree with you in full, but I felt that I had to change it just because of
the warning output by that tool. I don't like to have my patches discarded
because they don't fix checkpatch warnings or introduce new ones.
> If I wanted to check
> the resulting value of the sizeof(), the second form requires an additional
> step. It probably does not matter much to the compiler, but when I have to
do it
> manually, the extra effort is not negligible.
>
> Even though I disagree with the philosophy,
>
> Acked-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
>
Thanks for your "Acked-by" tag.
Fabio