From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569AbbE1F7h (ORCPT ); Thu, 28 May 2015 01:59:37 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:39611 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751068AbbE1F7b (ORCPT ); Thu, 28 May 2015 01:59:31 -0400 Message-ID: <5566AEB2.3090503@huawei.com> Date: Thu, 28 May 2015 13:59:14 +0800 From: Li Bin User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Jiri Slaby , Minfei Huang CC: Jiri Kosina , Nicholas Mc Guire , Josh Poimboeuf , Seth Jennings , Vojtech Pavlik , "live-patching@vger.kernel.org" , "linux-kernel@vger.kernel.org" , xiexiuqi , Hanjun Guo , "mhuang@redhat.com" Subject: Re: [PATCH] livepatch: match function return value type with prototype References: <1431323549-27343-1-git-send-email-hofrat@osadl.org> <5563DE28.4070100@huawei.com> <5564219B.9040406@suse.cz> In-Reply-To: <5564219B.9040406@suse.cz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.25.181] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5566AEBF.003B,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 70852f6436c28b766676beec9973e5e2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/5/26 15:32, Jiri Slaby wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 05/26/2015, 06:46 AM, Minfei Huang wrote: >> On Tue, May 26, 2015 at 10:44 AM, Li Bin >> wrote: >>> The klp_is_module return type should be boolean. >>> >>> Signed-off-by: Li Bin --- >>> kernel/livepatch/core.c | 2 +- 1 files changed, 1 >>> insertions(+), 1 deletions(-) >>> >>> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c >>> index 284e269..30e9339 100644 --- a/kernel/livepatch/core.c +++ >>> b/kernel/livepatch/core.c @@ -78,7 +78,7 @@ static struct klp_ops >>> *klp_find_ops(unsigned long old_addr) >>> >>> static bool klp_is_module(struct klp_object *obj) { - >>> return obj->name; + return !!obj->name; } >> >> Hi, Bin. >> >> Does compile blame the prototype before you convert it? If not, I >> think we do not need to fix it, since there are a lot of places in >> kernel where we return point value as boolean. > > Yes, but the real reason is not that we use it on a lot of places, but > that it is standardized in ΒΆ 6.3.1.2: > When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. > OK, I see, thank you! Li Bin > Along with the definition of scalar types: > Arithmetic types and pointer types are collectively called scalar types. > > thanks, > - -- > js > suse labs > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQIcBAEBCAAGBQJVZCGXAAoJEL0lsQQGtHBJMCEP/AufUwrMFZ7KTD/pWKpjpDlu > fP8eflJ7iBxGtHXe9PGOsthY4kd1mB+kCo+54N1gks9bbnWF6P302hck5zrBHBdH > /wbo7YXhbHicUNAXZUzxfDh3nkKmR96CIeqZhMp2H1UBzmGRKzd6kVSdBwlbJ0/W > ZNcWmiIaALdr7aMEw+qEExV35kUdbJaqUcHKC9in3qQtlzCVQbZ5mCqURe+61ZTL > 9u/Sbf3vB+nJPzyC/8uSVAxF616PiPdgGvxRrrRrRH82JmRaVJFjsRJ1WeMNxOFt > s4gbNByNePmTG3SisqFFKQ6VJYyeEsxkeRKbvL2mW4IlzJjiWCbp6XHcv2/IzR9g > GdIu3Kgy5R0OBXTxMbb5VLVtDRZUYnD/HiOFVLdUiqI6HQ/MtdZGujnVhWAVGIse > BD8T+hTOQyt6Yk7evlEF+REOlAU8jvBvnq3PUfRlUjWso8w0giPx1Re6rQk4k39P > TmfIVrve79n2nR/OejeCAB3xBEDtFbKBg9I+5ONm1gogxz/+3o6mwfMGS8TSdNs9 > l4Kl/dhQhSW3aOmrclUoOZpcAzfTJSNCepTFq6+hKIbKibtnKs63wkLnGyL+XZSE > dEOWBC/B5YNC9VVAm20U8jAtUS5gw3n0NpXFTxOi0nb62IGY+mT+D5pPylVn31Rq > H7FDzgpZ7+lyvx+FDqpv > =UzJg > -----END PGP SIGNATURE----- > -- > To unsubscribe from this list: send the line "unsubscribe live-patching" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > . >