public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* question about mtdchar.c
@ 2003-12-09 11:28 Axel Ludszuweit
  2003-12-09 11:33 ` David Woodhouse
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Ludszuweit @ 2003-12-09 11:28 UTC (permalink / raw)
  To: linux-mtd

Hello everybody,


I have a question, concerning the 
MEMGETINFO part of the mtd_ioctl function,
contained in .../mtd/drivers/mtd/mtdchar.c

I think, the right code is 


                .
                .
	case MEMGETINFO:
		if (copy_to_user((struct mtd_info_user *)arg, mtd,
                                         ^^^^^^^^^^^^^ 
				 sizeof(struct mtd_info_user)))
			return -EFAULT;
		break;
                .
                .

instead


                .
                .
	case MEMGETINFO:
		if (copy_to_user((struct mtd_info *)arg, mtd,
                                         ^^^^^^^^
				 sizeof(struct mtd_info_user)))
			return -EFAULT;
		break;
                .
                .

I have attached the patch file.
Is this correct or have I not understand the code?


----------------------------------------------------------------------------

--- mtd/drivers/mtd/mtdchar.c.ORIG      2003-12-09 10:55:14.000000000 +0100
+++ mtd/drivers/mtd/mtdchar.c   2003-12-09 10:57:01.000000000 +0100
@@ -283,7 +283,7 @@
        }

        case MEMGETINFO:
-               if (copy_to_user((struct mtd_info *)arg, mtd,
+               if (copy_to_user((struct mtd_info_user *)arg, mtd,
                                 sizeof(struct mtd_info_user)))
                        return -EFAULT;
                break;


----------------------------------------------------------------------------

--------------------------------------------

Axel Ludszuweit

Keymile GmbH
Wohlenbergstr. 3, D-30179 Hannover

Tel.: +49 511 / 978197-630
Fax : +49 511 / 978197-670
http://www.keymile.com
mailto:axel.ludszuweit@keymile.com

>> Be the FIRST on the LAST MILE <<

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

* Re: question about mtdchar.c
  2003-12-09 11:28 question about mtdchar.c Axel Ludszuweit
@ 2003-12-09 11:33 ` David Woodhouse
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2003-12-09 11:33 UTC (permalink / raw)
  To: Axel Ludszuweit; +Cc: linux-mtd

On Tue, 2003-12-09 at 12:28 +0100, Axel Ludszuweit wrote:
>         case MEMGETINFO:
> -               if (copy_to_user((struct mtd_info *)arg, mtd,
> +               if (copy_to_user((struct mtd_info_user *)arg, mtd,
>                                  sizeof(struct mtd_info_user)))
>                         return -EFAULT;

You're right -- thanks. But note that it's cosmetic; the type of the
pointer is irrelevant and the length is correct.

-- 
dwmw2

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

end of thread, other threads:[~2003-12-09 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-09 11:28 question about mtdchar.c Axel Ludszuweit
2003-12-09 11:33 ` David Woodhouse

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