Skip to content

Commit

Permalink
erofs: suppress false positive last_block warning
Browse files Browse the repository at this point in the history
As Andrew mentioned, some rare specific gcc versions could report
last_block uninitialized warning. Actually last_block doesn't need
to be uninitialized first from its implementation due to bio == NULL
condition. After a bio is allocated, last_block will be assigned
then.

The detailed analysis is in this thread [1]. So let's silence those
confusing gccs simply.

[1] https://lore.kernel.org/r/20200421072839.GA13867@hsiangkao-HP-ZHAN-66-Pro-G1

Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Link: https://lore.kernel.org/r/20200528084844.23359-1-hsiangkao@redhat.com
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
  • Loading branch information
Gao Xiang committed May 29, 2020
1 parent f57a3fe commit 34f853b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/erofs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
*/
static int erofs_raw_access_readpage(struct file *file, struct page *page)
{
erofs_off_t last_block;
erofs_off_t uninitialized_var(last_block);
struct bio *bio;

trace_erofs_readpage(page, true);
Expand All @@ -285,7 +285,7 @@ static int erofs_raw_access_readpages(struct file *filp,
struct list_head *pages,
unsigned int nr_pages)
{
erofs_off_t last_block;
erofs_off_t uninitialized_var(last_block);
struct bio *bio = NULL;
gfp_t gfp = readahead_gfp_mask(mapping);
struct page *page = list_last_entry(pages, struct page, lru);
Expand Down

0 comments on commit 34f853b

Please sign in to comment.