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)

static int snapshot_ioctl(struct inode *inode, struct file *filp,
                          unsigned int cmd, unsigned long arg)
{

        .
        .
        .


        case SNAPSHOT_SET_SWAP_FILE:
                if (!data->bitmap) {
                        /*
                         * User space encodes device types as two-byte values,
                         * so we need to recode them
                         */
                        if (old_decode_dev(arg)) {
                                data->swap = swap_type_of(old_decode_dev(arg),
                                                        0, NULL);
                                if (data->swap < 0)
                                        error = -ENODEV;
                        } else {
                                data->swap = -1;
                                error = -EINVAL;
                        }
                } else {
                        error = -EPERM;
                }
                break;


grts Tim

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------------
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