Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp955212ybb; Sat, 28 Mar 2020 14:26:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuZ9rsGpnJXeA8pM5tp8qtx/HrbKl5Wmdqgy7deYXx6sOfVkzB+8zmOS0uthLQEFkdhUlvs X-Received: by 2002:a9d:414:: with SMTP id 20mr4019346otc.300.1585430798249; Sat, 28 Mar 2020 14:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585430798; cv=none; d=google.com; s=arc-20160816; b=kJH3mLw85dXL2qD97uAwJBW2dJiD9k+X+FR/qHCfjNxM02TRJhrI5uwQKSbGx1kqYs X9nWiGAfG9k4H6WKDTnuXhZ/uEjx+pgBGRkoDGFH8GXf0QV8zJddJDVJiPssRh9O9Eee BhKB4wD9eHH3YtU+OjfrzgD6rw6CAy78uZM/meqxgn3BAurpzSEVarFRf88KfnxLO6zN Ws8rplK562jbqaFMC2AopOOTgsEvsoPZhFxOUVsAgHy+Dc0W8ZGPu4aeWTtNsi808p1V a21YGbQbwQDGXPqvKjzrVIoNYSfCkiwCrOE6+7pbgjdCksOgJ65rWBsxSfZ4qZQ+yoQJ uLIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Cy0P29m0MX5a7JFbLWS3gTrzYWk3vEpJ85XaL9jURGY=; b=NHXOmPoWyI/yqFPhT7EtSMphIULneQcGl06gLZU/8pGslWhM0SyvzPZNGfkybIfs9u Mw97WeovshurGXRJm1pz+3oHdMfvc73QcrscIxxTruZpH4bhQTdAAW5321Zr0+OW+C3j 4lFk3a+RjpWCZEi0jHwXPGAOnqBVVa0L0UFEDRqvfLRIpkwZODkbsA7tVj2XvEQ8AKOx qdn4f9W9cpVp4HlVg5WHRGVXjYPv7iFYx/Tj/7pn/XJ2oD7EP0Zrn8nk9dukdJjJ06Jv 6DnUD+ufdbFTHYIBJKeNcmObwnF3FWo2Fb3Fk7khqmVkJ7HRhKWfDlimAYqe/JLOGi9v 4PEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Fym4U+Oh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si4204647otq.90.2020.03.28.14.26.25; Sat, 28 Mar 2020 14:26:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Fym4U+Oh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727696AbgC1VYu (ORCPT + 99 others); Sat, 28 Mar 2020 17:24:50 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41071 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbgC1VYt (ORCPT ); Sat, 28 Mar 2020 17:24:49 -0400 Received: by mail-pl1-f194.google.com with SMTP id d24so1170234pll.8 for ; Sat, 28 Mar 2020 14:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Cy0P29m0MX5a7JFbLWS3gTrzYWk3vEpJ85XaL9jURGY=; b=Fym4U+OhmhAbl1OsMQYALcHZh8Cbq7DPseAxcdF8GVCBfn1m5pmejdl7MBDQzNM5R5 OWM8ZW+4c4IgDFIM+ijx7Uyw5qH+xM7rIUfAN/56TFdAmOHiEMrXne2TRw5j8HUrDjtE hT+A1ibxBhq9Mf0aBoV5UbX7a/Co0SN5finZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Cy0P29m0MX5a7JFbLWS3gTrzYWk3vEpJ85XaL9jURGY=; b=SEOUSlC8E6DN6EJfFh4sTgWFTff581gwqg9j5iCCsjXv4FNucJ9LMKhrbjJWMJTCY5 qrhLzNngG7KHIxz3/9bz/xZXMRhlhCofGD1IaFZmXjlzapYJE8T7qbpDX9V0oUhkHLlE O3BPGczS3q3y8mNAD8MTg0yEtYlg90dbtyUUw5L6LGayb4lGuoTxb26XZMt+XAad8IFu V1I2myh1GJWVThAV97lDUkgIH3+y42+3XbT1D52/hYFyaSBzSfzkKL/VfCaMOCRWjXTX H2V7BBGPSfs2RU/3uCjpkQ6LFV7f7G48ZiKHoeUO5rnKsY++LV1/rmTaC639RNuPCGhk 7P9Q== X-Gm-Message-State: ANhLgQ2mXwy76Sf/FUKHSrwv02JDHElt4ykeO5xhQszH2mRRahxNPtQF 51oPub1/h/cNI+pxDAeMU2W7lw== X-Received: by 2002:a17:90a:fa8f:: with SMTP id cu15mr5295441pjb.108.1585430688506; Sat, 28 Mar 2020 14:24:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h6sm6441542pjk.33.2020.03.28.14.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2020 14:24:47 -0700 (PDT) Date: Sat, 28 Mar 2020 14:24:46 -0700 From: Kees Cook To: Andrew Morton Cc: julia.lawall@lip6.fr, boqun.feng@gmail.com, Jules Irenge , Luis Chamberlain , Iurii Zaikin , "open list:PROC SYSCTL" , "open list:PROC SYSCTL" Subject: Re: [PATCH 09/10] kernel/sysctl.c: Replace 1 and 0 by corresponding boolean value Message-ID: <202003281423.E2DA6482@keescook> References: <0/10> <20200327212358.5752-1-jbi.octave@gmail.com> <20200327212358.5752-10-jbi.octave@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200327212358.5752-10-jbi.octave@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 09:23:56PM +0000, Jules Irenge wrote: > Coccinelle reports a warning > > WARNING: Assignment of 0/1 to bool variable > > To fix this, values 1 and 0 of first variable > are replaced by true and false respectively. > Given that variable first is of bool type. > This fixes the warnings. Sure! Thanks. :) > Signed-off-by: Jules Irenge Reviewed-by: Kees Cook -Kees > --- > kernel/sysctl.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index ad5b88a53c5a..4132a35e85bd 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -3158,7 +3158,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, > void __user *buffer, size_t *lenp, loff_t *ppos) > { > int err = 0; > - bool first = 1; > + bool first = true; > size_t left = *lenp; > unsigned long bitmap_len = table->maxlen; > unsigned long *bitmap = *(unsigned long **) table->data; > @@ -3249,7 +3249,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, > } > > bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); > - first = 0; > + first = false; > proc_skip_char(&p, &left, '\n'); > } > kfree(kbuf); > @@ -3281,7 +3281,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, > break; > } > > - first = 0; bit_b++; > + first = false; bit_b++; > } > if (!err) > err = proc_put_char(&buffer, &left, '\n'); > -- > 2.25.1 > -- Kees Cook