On Thu, Feb 10, 2011 at 12:50:14PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 08:12 Thu 10 Feb , Sascha Hauer wrote: > > On Thu, Feb 10, 2011 at 04:31:59AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > we check before the RW access for generic_memmap_ro instead of > > > generic_memmap_rw > > > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> > > > --- > > > drivers/base/driver.c | 5 +++-- > > > 1 files changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/base/driver.c b/drivers/base/driver.c > > > index ff92e44..bd7464e 100644 > > > --- a/drivers/base/driver.c > > > +++ b/drivers/base/driver.c > > > @@ -223,8 +223,6 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags) > > > if (!cdev->dev) > > > return -EINVAL; > > > > > > - if (flags & PROT_WRITE) > > > - return -EACCES; > > > *map = (void *)cdev->dev->map_base; > > > return 0; > > > } > > > @@ -234,6 +232,9 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags) > > > if (!cdev->dev) > > > return -EINVAL; > > > > > > + if (flags & PROT_WRITE) > > > + return -EACCES; > > > + > > > > So instead of allowing write access in the read/write function we now > > allow it in the readonly function? I'm afraid I don't understand this. > PROT_WRITE means ro no? No. The semantics are from mmap(2): PROT_EXEC Pages may be executed. PROT_READ Pages may be read. PROT_WRITE Pages may be written. PROT_NONE Pages may not be accessed. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox