Re: [patch] ath9k_hw: min_t() casts u32 to int

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

 



On Mon, 17 Oct 2011 10:28:23 +0300
Dan Carpenter <dan.carpenter@xxxxxxxxxx> 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@xxxxxxxxxx>

Reviewed-by: Pavel Roskin <proski@xxxxxxx>

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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux