Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335628 > unrolled thread

Re: [PATCH net-next 08/10] bus: mvenus-mbus: Fix size test for mvebu_mbus_get_dram_win_info

Started byGregory CLEMENT <gregory.clement@free-electrons.com>
First post2016-02-16 17:50 +0100
Last post2016-02-16 17:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH net-next 08/10] bus: mvenus-mbus: Fix size test for mvebu_mbus_get_dram_win_info Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-02-16 17:50 +0100

#1335628 — Re: [PATCH net-next 08/10] bus: mvenus-mbus: Fix size test for mvebu_mbus_get_dram_win_info

FromGregory CLEMENT <gregory.clement@free-electrons.com>
Date2016-02-16 17:50 +0100
SubjectRe: [PATCH net-next 08/10] bus: mvenus-mbus: Fix size test for mvebu_mbus_get_dram_win_info
Message-ID<r2QZ4-1Yc-5@gated-at.bofh.it>
Hi David,
 
 On jeu., janv. 14 2016, David Laight <David.Laight@ACULAB.COM> wrote:

> From: Gregory CLEMENT
>> Sent: 12 January 2016 19:11
>> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
>> ---
>>  drivers/bus/mvebu-mbus.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
>> index 3d1c0c3880ec..214bb964165b 100644
>> --- a/drivers/bus/mvebu-mbus.c
>> +++ b/drivers/bus/mvebu-mbus.c
>> @@ -964,7 +964,7 @@ int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
>>  	for (i = 0; i < dram->num_cs; i++) {
>>  		const struct mbus_dram_window *cs = dram->cs + i;
>> 
>> -		if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size)) {
>> +		if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size - 1)) {
>
> Wouldn't it be better to change the line to:
>> +		if (cs->base <= phyaddr && phyaddr < (cs->base +
>cs->size)) {

It doesn't work if there is 4GB of memory in this case we can have
cs->base + cs->size which wrap to 0 and the test fails. It was exactly
what happened on Armada XP GP board.

Gregory

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web