public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
@ 2006-10-17 15:27 Ricard Wanderlof
  2006-10-17 15:45 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ricard Wanderlof @ 2006-10-17 15:27 UTC (permalink / raw)
  To: Linux mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1401 bytes --]


Hi,

This is my first patch submission, so please correct me if I've done 
anything stupid or just plain wrong. :-)


1. The ECCGETLAYOUT ioctl copy_to_user() call has a superfluous '&' 
causing the resulting information to be garbage rather than the intended 
mtd->ecclayout.

2. The MEMGETOOBSEL misses copying mtd->ecclayout->eccbytes so the
resulting field of the returned structure contains garbage.


From: Ricard Wanderlof <ricardw at axis.com>
Signed-off-by: Ricard Wanderlof <ricardw at axis.com>


--- a/drivers/mtd/mtdchar.c	2006-10-17 17:10:45.929965640 +0200
+++ b/drivers/mtd/mtdchar.c	2006-10-17 17:12:10.000000000 +0200
@@ -616,6 +616,7 @@
  		memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos));
  		memcpy(&oi.oobfree, mtd->ecclayout->oobfree,
  		       sizeof(oi.oobfree));
+		oi.eccbytes = mtd->ecclayout->eccbytes;

  		if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo)))
  			return -EFAULT;
@@ -715,7 +716,7 @@
  		if (!mtd->ecclayout)
  			return -EOPNOTSUPP;

-		if (copy_to_user(argp, &mtd->ecclayout,
+		if (copy_to_user(argp, mtd->ecclayout,
  				 sizeof(struct nand_ecclayout)))
  			return -EFAULT;
  		break;

--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

[-- Attachment #2: patch file --]
[-- Type: TEXT/PLAIN, Size: 661 bytes --]

--- a/drivers/mtd/mtdchar.c	2006-10-17 17:10:45.929965640 +0200
+++ b/drivers/mtd/mtdchar.c	2006-10-17 17:12:10.000000000 +0200
@@ -616,6 +616,7 @@
 		memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos));
 		memcpy(&oi.oobfree, mtd->ecclayout->oobfree,
 		       sizeof(oi.oobfree));
+		oi.eccbytes = mtd->ecclayout->eccbytes;
 
 		if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo)))
 			return -EFAULT;
@@ -715,7 +716,7 @@
 		if (!mtd->ecclayout)
 			return -EOPNOTSUPP;
 
-		if (copy_to_user(argp, &mtd->ecclayout,
+		if (copy_to_user(argp, mtd->ecclayout,
 				 sizeof(struct nand_ecclayout)))
 			return -EFAULT;
 		break;

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

* Re: [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
  2006-10-17 15:27 [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls Ricard Wanderlof
@ 2006-10-17 15:45 ` Artem Bityutskiy
  2006-10-18  7:01   ` Ricard Wanderlof
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2006-10-17 15:45 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Linux mtd

Ricard,

On Tue, 2006-10-17 at 17:27 +0200, Ricard Wanderlof wrote:
> Hi,
> 
> This is my first patch submission, so please correct me if I've done 
> anything stupid or just plain wrong. :-)
> 
> 
> 1. The ECCGETLAYOUT ioctl copy_to_user() call has a superfluous '&' 
> causing the resulting information to be garbage rather than the intended 
> mtd->ecclayout.
> 
> 2. The MEMGETOOBSEL misses copying mtd->ecclayout->eccbytes so the
> resulting field of the returned structure contains garbage.

the patch looks OK, but it does not apply to the mtd git kernel. Will
you mind to send a patch against mtd-2.6.git please?

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

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

* Re: [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
  2006-10-17 15:45 ` Artem Bityutskiy
@ 2006-10-18  7:01   ` Ricard Wanderlof
  2006-10-18  9:04     ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ricard Wanderlof @ 2006-10-18  7:01 UTC (permalink / raw)
  To: Linux mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 703 bytes --]


On Tue, 17 Oct 2006, Artem Bityutskiy wrote:

> the patch looks OK, but it does not apply to the mtd git kernel. Will
> you mind to send a patch against mtd-2.6.git please?

That's what I thought I did ... checked again today, yep it is based 
against the latest mtdchar.c from mtd-2.6.git tree (dated 2006-09-17).

However, it looks like the patch in the body of the email might have had 
its whitespace mangled. I did send the patch as an attachement too, did 
you try that?

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

* Re: [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
  2006-10-18  7:01   ` Ricard Wanderlof
@ 2006-10-18  9:04     ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2006-10-18  9:04 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Linux mtd

On Wed, 2006-10-18 at 09:01 +0200, Ricard Wanderlof wrote:
> That's what I thought I did ... checked again today, yep it is based 
> against the latest mtdchar.c from mtd-2.6.git tree (dated 2006-09-17).

Richard, apologies, the patch indeed applies smoothly. I have committed
it into my git tree and will ask David to get it into mtd-2.6.git.

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

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

end of thread, other threads:[~2006-10-18  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-17 15:27 [PATCH] [MTD] [CORE]: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls Ricard Wanderlof
2006-10-17 15:45 ` Artem Bityutskiy
2006-10-18  7:01   ` Ricard Wanderlof
2006-10-18  9:04     ` Artem Bityutskiy

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