On Thursday, 29 March 2007 00:14, Tim Dijkstra wrote:
> On Tue, 27 Mar 2007 23:11:41 +0200
> "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> 
> > > diff -u -r1.70 suspend.c
> > > --- suspend.c   16 Mar 2007 16:02:22 -0000      1.70
> > > +++ suspend.c   27 Mar 2007 20:36:52 -0000
> > > @@ -208,7 +208,7 @@
> > >         swap.offset = offset;
> > >         error = ioctl(dev, SNAPSHOT_SET_SWAP_AREA, &swap);
> > >         if (error && !offset)
> > > -               error = ioctl(dev, SNAPSHOT_SET_SWAP_FILE, blkdev);
> > > +               error = ioctl(dev, SNAPSHOT_SET_SWAP_FILE, (unsigned 
> > > long) blkdev);  
> > 
> > Heh, I wonder. :-)
> 
> 
> Apparently it worked... IMHO this means the code in user.c should be
> different. snapshot_ioctl expects an unsigned long, which isn't what 
> the user sends. Would it be useful to use copy_from_user()? (Disclaimer
> I haven't written a single line of kernel code yet, this is just from
> reading user.c)

Well, maybe, but then we'd have to redefine the ioctl which I'd rather avoid.
Besides, the kernel only needs the lower 32 bits anyway, so why should we
complicate things to pass the remaining 32 zero bits to it for nothing?

The problem is that in fact the kernel expects us to provide a _pointer_
as arg to the ioctl and unsigned long just happens to be of the same size.  So
I think we can live with your hack in the userland just fine (but please add a
comment explaining why its needed).

Greetings,
Rafael

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to