From: quic_zijuhu <quic_zijuhu@quicinc.com>
To: Johannes Berg <johannes@sipsolutions.net>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<emmanuel.grumbach@intel.com>
Cc: <linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] net: rfkill: Fix a wrongly handling error case
Date: Wed, 12 Jun 2024 18:12:45 +0800 [thread overview]
Message-ID: <9ab68c04-b33f-4f76-a563-2bc9d6c01401@quicinc.com> (raw)
In-Reply-To: <5d901b213389c38eb5bd1df37cb8a1c3d82ebba5.camel@sipsolutions.net>
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
next prev parent reply other threads:[~2024-06-12 10:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 14:40 [PATCH v1 0/2] net: rfkill: Fix 2 bugs within rfkill_set_hw_state_reason() Zijun Hu
2024-06-07 14:40 ` [PATCH v1 1/2] net: rfkill: Fix a wrongly handling error case Zijun Hu
2024-06-12 8:15 ` Johannes Berg
2024-06-12 10:12 ` quic_zijuhu [this message]
2024-06-12 10:14 ` Johannes Berg
2024-06-07 14:40 ` [PATCH v1 2/2] net: rfkill: Fix a logic error within rfkill_set_hw_state_reason() Zijun Hu
2024-06-12 8:18 ` Johannes Berg
2024-06-12 9:43 ` quic_zijuhu
2024-06-12 10:10 ` Johannes Berg
2024-06-12 10:11 ` Johannes Berg
2024-06-12 10:18 ` Johannes Berg
2024-06-12 10:35 ` quic_zijuhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ab68c04-b33f-4f76-a563-2bc9d6c01401@quicinc.com \
--to=quic_zijuhu@quicinc.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=emmanuel.grumbach@intel.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox