Search Linux Wireless

Re: [PATCH -next] rfkill: remove BUG_ON() in core.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 21, 2022 at 09:01:04PM +0800, Yang Yingliang wrote:
> Replace BUG_ON() with pointer check to handle fault more gracefully.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
> ---
>  net/rfkill/core.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> index dac4fdc7488a..5fc96fa24eda 100644
> --- a/net/rfkill/core.c
> +++ b/net/rfkill/core.c
> @@ -150,9 +150,8 @@ EXPORT_SYMBOL(rfkill_get_led_trigger_name);
>  
>  void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
>  {
> -	BUG_ON(!rfkill);
> -
> -	rfkill->ledtrigname = name;
> +	if (rfkill)

In all these places, rfkill shouldn't be NULL from the beginning. By
adding these if (rfkill), you are saying to reviewers and code authors
that it is correct thing to do something like this
rfkill_set_led_trigger_name(NULL, "new_name"), which is of course not
true.

Thanks



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux