Re: [PATCH][spi-next] spi: stm32: fix range limit checks on div

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

 



On 22/06/17 16:49, Amelie DELAUNAY wrote:
> Hi Colin,
> 
> I'm preparing a v2 for the initial patchset introducing spi-stm32, if
> you agree, I can directly add your fix.

Yep, please do, sounds like a plan.

Colin
> 
> Regards,
> Amelie
> 
> On 06/22/2017 05:41 PM, Colin King wrote:
>> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>>
>> Currently the check for range limits on div is incorrect and will
>> never return -EINVAL. Fix this by replacing && with ||
>>
>> Detected by CoverityScan, CID#1446580 ("Structurally dead code")
>>
>> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>> ---
>>   drivers/spi/spi-stm32.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
>> index 0553f61ab3b7..b75909e7b117 100644
>> --- a/drivers/spi/spi-stm32.c
>> +++ b/drivers/spi/spi-stm32.c
>> @@ -262,7 +262,7 @@ static int stm32_spi_prepare_mbr(struct stm32_spi
>> *spi, u32 speed_hz)
>>        * no need to check it there.
>>        * However, we need to ensure the following calculations.
>>        */
>> -    if ((div < SPI_MBR_DIV_MIN) &&
>> +    if ((div < SPI_MBR_DIV_MIN) ||
>>           (div > SPI_MBR_DIV_MAX))
>>           return -EINVAL;
>>  

--
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