linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] Introducing new bugs with fixups - one safe story
@ 2005-12-19 16:32 Blaisorblade
  0 siblings, 0 replies; only message in thread
From: Blaisorblade @ 2005-12-19 16:32 UTC (permalink / raw)
  To: user-mode-linux-devel

One nice day a clumsy programmer (let's say me) on a "call for fixing" day 
wrote the following patch (host_kern.c):

-       start = (long long) (page->index << PAGE_CACHE_SHIFT) + from;
+       start = ((long long) page->index) << PAGE_CACHE_SHIFT + from;

to make sure page->index was casted before shifting, to avoid losing 
information. But look below. Does the new line:

        start = ((long long) page->index) << PAGE_CACHE_SHIFT + from;

must be interpreted as:

        start = (((long long) page->index) << PAGE_CACHE_SHIFT) + from;
(what I meant) or as 
        start = ((long long) page->index) << (PAGE_CACHE_SHIFT + from);

?

This message is given as help:

  CC [M]  fs/hostfs/hostfs_kern.o
/home/paolo/Admin/kernel/6/VCS/linux-2.6.git/fs/hostfs/hostfs_kern.c: In 
function `hostfs_commit_write':
/home/paolo/Admin/kernel/6/VCS/linux-2.6.git/fs/hostfs/hostfs_kern.c:504: 
warning: suggest parentheses around + or - inside shift

Luckily, however, the clumsy programmer saw the message and learned The Way 
(tm). And the patch hadn't been merged yet. Another point for GCC.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

		
___________________________________ 
Yahoo! Messenger: chiamate gratuite in tutto il mondo 
http://it.messenger.yahoo.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

only message in thread, other threads:[~2005-12-19 16:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-19 16:32 [uml-devel] Introducing new bugs with fixups - one safe story Blaisorblade

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