question about mtdchar.c

Axel Ludszuweit alu at keymile.com
Tue Dec 9 06:28:47 EST 2003


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 at keymile.com

>> Be the FIRST on the LAST MILE <<





More information about the linux-mtd mailing list