From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <rmani@qca.qualcomm.com>
Cc: <linux-wireless@vger.kernel.org>,
ath6kl-devel <ath6kl-devel@qualcomm.com>
Subject: Re: [PATCH 1/3] ath6kl: Avoid null ptr dereference while printing reg domain pair
Date: Fri, 21 Sep 2012 12:14:55 +0300 [thread overview]
Message-ID: <505C300F.3060407@qca.qualcomm.com> (raw)
In-Reply-To: <1348122068-24648-1-git-send-email-rmani@qca.qualcomm.com>
On 09/20/2012 09:21 AM, rmani@qca.qualcomm.com wrote:
> From: Raja Mani <rmani@qca.qualcomm.com>
>
> Return value of ath6kl_get_regpair() is stored in 'regpair' in
> ath6kl_wmi_regdomain_event() func and it's directly accessed
> in the debug prints without checking for NULL value. There are
> situation to get NULL pointer as a return value from
> ath6kl_get_regpair() func. Fix this.
>
> Found this on code review.
>
> Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath6kl/wmi.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
> index 68b46bd..d5263ff 100644
> --- a/drivers/net/wireless/ath/ath6kl/wmi.c
> +++ b/drivers/net/wireless/ath/ath6kl/wmi.c
> @@ -936,8 +936,9 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len)
>
> regpair = ath6kl_get_regpair((u16) reg_code);
> country = ath6kl_regd_find_country_by_rd((u16) reg_code);
> - ath6kl_dbg(ATH6KL_DBG_WMI, "Regpair used: 0x%0x\n",
> - regpair->regDmnEnum);
> + if (regpair)
> + ath6kl_dbg(ATH6KL_DBG_WMI, "Regpair used: 0x%0x\n",
> + regpair->regDmnEnum);
The problem with this is that the regpair debug print is not printed at
all. Maybe something like this:
if (regpair)
ath6kl_dbg(ATH6KL_DBG_WMI, "Regpair used: 0x%0x\n",
regpair->regDmnEnum);
else
ath6kl_warn("Regpair not found reg_code 0x%0x\n",
reg_code);
I used the ath6kl_warn() here as this should not happen and we can more
easily notice the issue with ath6kl_warn(). Actually someone reported
about this crash on IRC earlier this week.
Kalle
prev parent reply other threads:[~2012-09-21 9:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-20 6:21 [PATCH 1/3] ath6kl: Avoid null ptr dereference while printing reg domain pair rmani
2012-09-20 6:21 ` [PATCH 2/3] ath6kl: Check for valid rate table index rmani
2012-09-21 9:16 ` Kalle Valo
2012-09-20 6:21 ` [PATCH 3/3] ath6kl: Check for valid endpoint ID values in ath6kl_control_tx() rmani
2012-09-21 9:18 ` Kalle Valo
2012-09-21 9:34 ` Raja Mani
2012-09-21 9:35 ` Raja Mani
2012-09-21 9:14 ` Kalle Valo [this message]
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=505C300F.3060407@qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath6kl-devel@qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rmani@qca.qualcomm.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;
as well as URLs for NNTP newsgroup(s).