mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* USER_DS vs oldfs
@ 2004-09-29 12:22 Matthew Wilcox
  0 siblings, 0 replies; only message in thread
From: Matthew Wilcox @ 2004-09-29 12:22 UTC (permalink / raw)
  To: linux-kernel


A common idiom in the compat code is:

                old_fs = get_fs();
                set_fs(KERNEL_DS);
                ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
                                ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
                                (unsigned long)&f);
                set_fs(old_fs);

Surely we know that the current 'fs' is USER_DS and so we could simply do:

                set_fs(KERNEL_DS);
                ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
                                ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
                                (unsigned long)&f);
                set_fs(USER_DS);

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-29 12:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-29 12:22 USER_DS vs oldfs Matthew Wilcox

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

all inboxes | Powered by JetHome®