lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52A67973.20904@gmail.com>
Date:	Tue, 10 Dec 2013 10:16:19 +0800
From:	Chen Gang <gang.chen.5i5j@...il.com>
To:	Seth Jennings <sjennings@...iantweb.net>
CC:	Seth Jennings <sjenning@...ux.vnet.ibm.com>, linux-mm@...ck.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	James Hogan <james.hogan@...tec.com>
Subject: Re: [PATCH] mm/zswap.c: add BUG() for default case in zswap_writeback_entry()

On 12/09/2013 11:36 PM, Seth Jennings wrote:
> On Mon, Dec 09, 2013 at 10:51:16AM +0800, Chen Gang wrote:
>> Recommend to add default case to avoid compiler's warning, although at
>> present, the original implementation is still correct.
>>
>> The related warning (with allmodconfig for metag):
>>
>>     CC      mm/zswap.o
>>   mm/zswap.c: In function 'zswap_writeback_entry':
>>   mm/zswap.c:537: warning: 'ret' may be used uninitialized in this function
>>
>>
>> Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
>> ---
>>  mm/zswap.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/mm/zswap.c b/mm/zswap.c
>> index 5a63f78..bfd1807 100644
>> --- a/mm/zswap.c
>> +++ b/mm/zswap.c
>> @@ -585,6 +585,8 @@ static int zswap_writeback_entry(struct zbud_pool *pool, unsigned long handle)
>>  
>>  		/* page is up to date */
>>  		SetPageUptodate(page);
>> +	default:
>> +		BUG();
> 
> Typically, the way you want to address this is initialize ret to 0
> at declaration time if not every control path will set that value.
> 

At least, your suggestion sounds reasonable.

But I am also aware that normally need content 'default' for 'switch',
so I choose this fix way.

And sorry, current patch is incorrect (need 'break' before 'default'),
so if no additional suggestions or discussions or completions, I
will/should send patch v2 for it.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ