public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* NOR read/write beyond end of flash partition
@ 2006-11-30 13:15 Tigadi Kiran-r10350c
  2006-11-30 13:27 ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Tigadi Kiran-r10350c @ 2006-11-30 13:15 UTC (permalink / raw)
  To: linux-mtd

Hi,

>From linux-2.6.10/drivers/mtd/mtdchar.c file mtd_write routine is
implemented to check MTD size (if (*ppos == mtd->size) and it will
return ENOSPC if you try to read beyond NOR MTD partition.

But mtd_read routine implemented in the same file does not have this
check. So when I try to read beyond end of NOR MTD partition it is
returning 0. 

Please let me know if any code updates are required.


Regards,
Kiran

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NOR read/write beyond end of flash partition
  2006-11-30 13:15 NOR read/write beyond end of flash partition Tigadi Kiran-r10350c
@ 2006-11-30 13:27 ` Artem Bityutskiy
  2006-11-30 15:53   ` Tigadi Kiran-r10350c
  0 siblings, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2006-11-30 13:27 UTC (permalink / raw)
  To: Tigadi Kiran-r10350c; +Cc: linux-mtd

Hello,

On Thu, 2006-11-30 at 18:45 +0530, Tigadi Kiran-r10350c wrote:
> But mtd_read routine implemented in the same file does not have this
> check. So when I try to read beyond end of NOR MTD partition it is
> returning 0. 

Sounds like a bug, feel free to send a patch against mtd-2.6.git tree.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-11-30 13:27 ` Artem Bityutskiy
@ 2006-11-30 15:53   ` Tigadi Kiran-r10350c
  2006-12-01  8:33     ` Artem Bityutskiy
  2006-12-01  8:44     ` Artem Bityutskiy
  0 siblings, 2 replies; 8+ messages in thread
From: Tigadi Kiran-r10350c @ 2006-11-30 15:53 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

Hi Artem,

Please find attached patch for drivers/mtd/mtdchar.c file to fix NOR read beyond flash. Let me know whether it is valid fix.

Regards,
Kiran

-----Original Message-----
From: Artem Bityutskiy [mailto:dedekind@infradead.org] 
Sent: Thursday, November 30, 2006 6:57 PM
To: Tigadi Kiran-r10350c
Cc: linux-mtd@lists.infradead.org
Subject: Re: NOR read/write beyond end of flash partition

Hello,

On Thu, 2006-11-30 at 18:45 +0530, Tigadi Kiran-r10350c wrote:
> But mtd_read routine implemented in the same file does not have this
> check. So when I try to read beyond end of NOR MTD partition it is
> returning 0. 

Sounds like a bug, feel free to send a patch against mtd-2.6.git tree.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)


[-- Attachment #2: mtdchar_patch --]
[-- Type: application/octet-stream, Size: 305 bytes --]

--- drivers/mtd/mtdchar.c	2006-11-30 21:16:50.000000000 +0530
+++ drivers/mtd/mtdchar.new.c	2006-11-21 18:27:46.000000000 +0530
@@ -161,6 +161,9 @@
 
 	DEBUG(MTD_DEBUG_LEVEL0,"MTD_read\n");
 
+	if (*ppos == mtd->size)
+		return -ENOSPC;
+	
 	if (*ppos + count > mtd->size)
 		count = mtd->size - *ppos;
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-11-30 15:53   ` Tigadi Kiran-r10350c
@ 2006-12-01  8:33     ` Artem Bityutskiy
  2006-12-01  8:44     ` Artem Bityutskiy
  1 sibling, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2006-12-01  8:33 UTC (permalink / raw)
  To: Tigadi Kiran-r10350c; +Cc: linux-mtd

On Thu, 2006-11-30 at 21:23 +0530, Tigadi Kiran-r10350c wrote:
> Please find attached patch for drivers/mtd/mtdchar.c file to fix NOR read beyond flash. Let me know whether it is valid fix.

Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-11-30 15:53   ` Tigadi Kiran-r10350c
  2006-12-01  8:33     ` Artem Bityutskiy
@ 2006-12-01  8:44     ` Artem Bityutskiy
  2006-12-01  9:48       ` Tigadi Kiran-r10350c
  1 sibling, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2006-12-01  8:44 UTC (permalink / raw)
  To: Tigadi Kiran-r10350c; +Cc: linux-mtd

On Thu, 2006-11-30 at 21:23 +0530, Tigadi Kiran-r10350c wrote:
> Hi Artem,
> 
> Please find attached patch for drivers/mtd/mtdchar.c file to fix NOR read beyond flash. Let me know whether it is valid fix.

I've looked at the code. Your patch is incorrect as mtd_read() should
return EOF if *ppos == mtd->size, not -ENOSPC.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-12-01  8:44     ` Artem Bityutskiy
@ 2006-12-01  9:48       ` Tigadi Kiran-r10350c
  2006-12-01  9:59         ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Tigadi Kiran-r10350c @ 2006-12-01  9:48 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Hi Artem,

As write routine implementation has -ENOSPC, I created patch with read routine returning same value.

So, please let me know which patch is valid?

Regards,
Kiran

-----Original Message-----
From: Artem Bityutskiy [mailto:dedekind@infradead.org] 
Sent: Friday, December 01, 2006 2:14 PM
To: Tigadi Kiran-r10350c
Cc: linux-mtd@lists.infradead.org
Subject: RE: NOR read/write beyond end of flash partition

On Thu, 2006-11-30 at 21:23 +0530, Tigadi Kiran-r10350c wrote:
> Hi Artem,
> 
> Please find attached patch for drivers/mtd/mtdchar.c file to fix NOR read beyond flash. Let me know whether it is valid fix.

I've looked at the code. Your patch is incorrect as mtd_read() should
return EOF if *ppos == mtd->size, not -ENOSPC.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-12-01  9:48       ` Tigadi Kiran-r10350c
@ 2006-12-01  9:59         ` Artem Bityutskiy
  2006-12-05  5:09           ` Tigadi Kiran-r10350c
  0 siblings, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2006-12-01  9:59 UTC (permalink / raw)
  To: Tigadi Kiran-r10350c; +Cc: linux-mtd

On Fri, 2006-12-01 at 15:18 +0530, Tigadi Kiran-r10350c wrote:
> Hi Artem,
> 
> As write routine implementation has -ENOSPC, I created patch with read routine returning same value.
> 
> So, please let me know which patch is valid?

Pardon? I think there is no need in a patch and mtd_read() is ok as it
is.


-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: NOR read/write beyond end of flash partition
  2006-12-01  9:59         ` Artem Bityutskiy
@ 2006-12-05  5:09           ` Tigadi Kiran-r10350c
  0 siblings, 0 replies; 8+ messages in thread
From: Tigadi Kiran-r10350c @ 2006-12-05  5:09 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Hi Artem,

Could you please give the exact reason why this is NOT a bug?

Regards,
Kiran

-----Original Message-----
From: Artem Bityutskiy [mailto:dedekind@infradead.org] 
Sent: Friday, December 01, 2006 3:29 PM
To: Tigadi Kiran-r10350c
Cc: linux-mtd@lists.infradead.org
Subject: RE: NOR read/write beyond end of flash partition

On Fri, 2006-12-01 at 15:18 +0530, Tigadi Kiran-r10350c wrote:
> Hi Artem,
> 
> As write routine implementation has -ENOSPC, I created patch with read routine returning same value.
> 
> So, please let me know which patch is valid?

Pardon? I think there is no need in a patch and mtd_read() is ok as it
is.


-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-12-05  5:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30 13:15 NOR read/write beyond end of flash partition Tigadi Kiran-r10350c
2006-11-30 13:27 ` Artem Bityutskiy
2006-11-30 15:53   ` Tigadi Kiran-r10350c
2006-12-01  8:33     ` Artem Bityutskiy
2006-12-01  8:44     ` Artem Bityutskiy
2006-12-01  9:48       ` Tigadi Kiran-r10350c
2006-12-01  9:59         ` Artem Bityutskiy
2006-12-05  5:09           ` Tigadi Kiran-r10350c

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox