All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [patch] ath9k_hw: min_t() casts u32 to int
Date: Tue, 18 Oct 2011 16:19:48 -0400	[thread overview]
Message-ID: <20111018161948.2552f995@mj> (raw)
In-Reply-To: <20111017072823.GA7812@elgon.mountain>

On Mon, 17 Oct 2011 10:28:23 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The code here treats very large values of "limit" as less than
> MAX_POWER_RATE because of the cast to int.  We should do the compare
> as u32 instead.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Pavel Roskin <proski@gnu.org>

I don't think it can actually happen.  ath9k_hw_set_txpowerlimit() is
called twice.  In one case, limit is MAX_RATE_POWER, in another case,
it's an argument of type u16.  Still, it's better not to have the code
that looks wrong.

ath9k_cmn_update_txpow() also has code that _looks_ wrong.  *txpower is
not assigned a value if the new power happens to be equal to the
current one.  Also, the second argument (cur_txpow) is not used.
Returning a value by a pointer seems unnecessary if the function returns
void.  It could simply return the new tx power.  I'll submit a patch
shortly.

-- 
Regards,
Pavel Roskin

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Roskin <proski@gnu.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>,
	Jouni Malinen <jouni@qca.qualcomm.com>,
	Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>,
	Senthil Balasubramanian <senthilb@qca.qualcomm.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ath9k_hw: min_t() casts u32 to int
Date: Tue, 18 Oct 2011 20:19:48 +0000	[thread overview]
Message-ID: <20111018161948.2552f995@mj> (raw)
In-Reply-To: <20111017072823.GA7812@elgon.mountain>

On Mon, 17 Oct 2011 10:28:23 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The code here treats very large values of "limit" as less than
> MAX_POWER_RATE because of the cast to int.  We should do the compare
> as u32 instead.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Pavel Roskin <proski@gnu.org>

I don't think it can actually happen.  ath9k_hw_set_txpowerlimit() is
called twice.  In one case, limit is MAX_RATE_POWER, in another case,
it's an argument of type u16.  Still, it's better not to have the code
that looks wrong.

ath9k_cmn_update_txpow() also has code that _looks_ wrong.  *txpower is
not assigned a value if the new power happens to be equal to the
current one.  Also, the second argument (cur_txpow) is not used.
Returning a value by a pointer seems unnecessary if the function returns
void.  It could simply return the new tx power.  I'll submit a patch
shortly.

-- 
Regards,
Pavel Roskin

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Roskin <proski@gnu.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>,
	Jouni Malinen <jouni@qca.qualcomm.com>,
	Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>,
	Senthil Balasubramanian <senthilb@qca.qualcomm.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ath9k_hw: min_t() casts u32 to int
Date: Tue, 18 Oct 2011 16:19:48 -0400	[thread overview]
Message-ID: <20111018161948.2552f995@mj> (raw)
In-Reply-To: <20111017072823.GA7812@elgon.mountain>

On Mon, 17 Oct 2011 10:28:23 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The code here treats very large values of "limit" as less than
> MAX_POWER_RATE because of the cast to int.  We should do the compare
> as u32 instead.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Pavel Roskin <proski@gnu.org>

I don't think it can actually happen.  ath9k_hw_set_txpowerlimit() is
called twice.  In one case, limit is MAX_RATE_POWER, in another case,
it's an argument of type u16.  Still, it's better not to have the code
that looks wrong.

ath9k_cmn_update_txpow() also has code that _looks_ wrong.  *txpower is
not assigned a value if the new power happens to be equal to the
current one.  Also, the second argument (cur_txpow) is not used.
Returning a value by a pointer seems unnecessary if the function returns
void.  It could simply return the new tx power.  I'll submit a patch
shortly.

-- 
Regards,
Pavel Roskin

  reply	other threads:[~2011-10-18 20:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17  7:28 [ath9k-devel] [patch] ath9k_hw: min_t() casts u32 to int Dan Carpenter
2011-10-17  7:28 ` Dan Carpenter
2011-10-17  7:28 ` Dan Carpenter
2011-10-18 20:19 ` Pavel Roskin [this message]
2011-10-18 20:19   ` Pavel Roskin
2011-10-18 20:19   ` Pavel Roskin

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=20111018161948.2552f995@mj \
    --to=proski@gnu.org \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.