Messages in this thread | | | Subject | Re: [2.4.23-pre3] Possible bug in fs/buffer.c | From | Andreas Schwab <> | Date | Mon, 08 Sep 2003 17:42:40 +0200 |
| |
Rolf Eike Beer <eike-kernel@sf-tec.de> writes:
> This is __put_unused_buffer_head from fs/buffer.c, lines 1156 to 1171: > > > static void __put_unused_buffer_head(struct buffer_head * bh) > { > if (unlikely(buffer_attached(bh))) > BUG(); > if (nr_unused_buffer_heads >= MAX_UNUSED_BUFFERS) { > kmem_cache_free(bh_cachep, bh); > } else { > bh->b_dev = B_FREE; > ===> bh->b_blocknr = -1; <=== > bh->b_this_page = NULL; > > nr_unused_buffer_heads++; > bh->b_next_free = unused_list; > unused_list = bh; > } > } > > In include/linux/fs.h "struct buffer_head" is defined this way: > > struct buffer_head { > /* First cache line: */ > struct buffer_head *b_next; /* Hash queue list */ > unsigned long b_blocknr; /* block number */ > ... > > So this line (and line 1205, which is the same) is either ugly (and someone > meant ~0UL or something similar) or completely bogus.
It's neither ugly, nor bogus. The only 100% reliable way to assign the maximum value to an unsigned integer is to use -1.
Andreas.
-- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |