[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ab68c04-b33f-4f76-a563-2bc9d6c01401@quicinc.com>
Date: Wed, 12 Jun 2024 18:12:45 +0800
From: quic_zijuhu <quic_zijuhu@...cinc.com>
To: Johannes Berg <johannes@...solutions.net>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<emmanuel.grumbach@...el.com>
CC: <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH v1 1/2] net: rfkill: Fix a wrongly handling error case
On 6/12/2024 4:15 PM, Johannes Berg wrote:
>>
>> use pr_err() instead of WARN()
>> for this error case handling.
>
> I don't see anything wrong with the WARN here, it's the user/driver
> calling it completely incorrectly.
>
the function is a kernel API and it is handing invalid user input.
below comments for WARN() seems say that pr_err() is better than WARN()
for this case.
include/asm-generic/bug.h:
/*
* WARN(), WARN_ON(), WARN_ON_ONCE(), and so on can be used to report
* significant kernel issues that need prompt attention if they should ever
* appear at runtime.
*
* Do not use these macros when checking for invalid external inputs
* (e.g. invalid system call arguments, or invalid data coming from
* network/devices), and on transient conditions like ENOMEM or EAGAIN.
* These macros should be used for recoverable kernel issues only.
* For invalid external inputs, transient conditions, etc use
* pr_err[_once/_ratelimited]() followed by dump_stack(), if necessary.
* Do not include "BUG"/"WARNING" in format strings manually to make these
* conditions distinguishable from kernel issues.
*
* Use the versions with printk format strings to provide better
diagnostics.
*/
> I also don't really think this is a *fix*, if you used the API
> incorrectly you can't necessarily expect a correct return value, I
> guess, but anyway it shouldn't happen in the first place.
>
okay, will remove term fix and fix tag. the API returns type bool for
block state, the type bool can't cover case for invalid user input.
> I'm happy to take the return value change (only) as a cleanup, if you
> wish to resend that.
>
i am pleasure to resend it after code review done.
>> Fixed by
>
> Please also read
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
>
okay, thank you
> johannes
Powered by blists - more mailing lists