Introducing new bugs with fixups - one safe story
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.
Signature · 20 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel