Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1772638imd; Thu, 1 Nov 2018 23:47:58 -0700 (PDT) X-Google-Smtp-Source: AJdET5eTgvGnno9LtABubNfkMZ+tgYN6tiqz1JcVQ3pSFJlZaIQnVpBcl3SB5R8gww/Oq/jh1o9F X-Received: by 2002:a17:902:3e3:: with SMTP id d90-v6mr10523632pld.118.1541141278394; Thu, 01 Nov 2018 23:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541141278; cv=none; d=google.com; s=arc-20160816; b=CVXH+FwaS2gOeyormQ0gWCPAtU7rX4ixqREJ3yafQiPW6vIbdO9orquniZmJGWDSzL Xx8WI3VOlJ4mRoxlGreEpUK6HaPP3rNtulBQ51Z/uKhlfeXDsI6VUJNv+ho9AVj9XtPD j3OXm4y8DjbIh+4FrNY0wC/miFsrNTXTkqKlFFL6sft8uXfvGog11zBv8EWEaRvLQlRz YzFQSsp29zXq4oJoFVut7Rw7rGs7ADEQk6hy9qtlLg46Zt59bBPBLQAl+fwUSyJcaR2a zKdYMuLMhSKld46I2sS8nUF7hdlrPz3O4WDm3R9ir7rR1l1eqm3mqIRSQTQB3WEvuxWe sXHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=h49J8IWjWfgV9IbYWMKByk/VHh3Q9YNkOmietcs2eek=; b=KOTJnFvByY8cGh9up3hF2ldjyCGHVoHpkc06qwTSrqB6qgi5aWqt9HMd1Z99LKR7fO Dfnj0k8pQA6j50g08a7WNUpJZRXIz6iWHykUkYuqjiT9d3miWXH1fsr7eb5PJtw9qL14 RqtkTEt7I5P56+yJImgqRkOZKrm9TmCrWqe415KuN2PCEx+ZwxqTbM/6aHb1ATAGoXXu w+62oZ5UREuuKzPgL1Idzl3ZEcsAH8wqSX1iIKJklGTEyIz8O59LwIki2SGcrlRST0tb auZAo/2xceSAPd3ThreJnSQi13CQ6Sh7HMDBgi/+eh2vfwbFU0/mvWuRUzBXxrxMziua YV2g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si28729641plp.114.2018.11.01.23.47.43; Thu, 01 Nov 2018 23:47:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728325AbeKBPx2 (ORCPT + 99 others); Fri, 2 Nov 2018 11:53:28 -0400 Received: from mga04.intel.com ([192.55.52.120]:15479 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbeKBPx2 (ORCPT ); Fri, 2 Nov 2018 11:53:28 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2018 23:47:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,454,1534834800"; d="scan'208";a="97077939" Received: from lkp-server01.sh.intel.com (HELO lkp-server01) ([10.239.97.150]) by orsmga003.jf.intel.com with ESMTP; 01 Nov 2018 23:47:19 -0700 Received: from kbuild by lkp-server01 with local (Exim 4.89) (envelope-from ) id 1gITEl-000Fhp-39; Fri, 02 Nov 2018 14:47:19 +0800 Date: Fri, 2 Nov 2018 14:47:14 +0800 From: kbuild test robot To: Matthew Garrett Cc: kbuild-all@01.org, John Johansen , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] apparmor: fix boolreturn.cocci warnings Message-ID: <20181102064714.GA4525@lkp-wsm-ep1> References: <201811021410.91btpktw%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201811021410.91btpktw%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: kbuild test robot security/apparmor/policy_unpack.c:242:9-10: WARNING: return of 0/1 in function 'unpack_X' with return type bool security/apparmor/policy_unpack.c:288:9-10: WARNING: return of 0/1 in function 'unpack_nameX' with return type bool security/apparmor/policy_unpack.c:615:8-9: WARNING: return of 0/1 in function 'unpack_rlimits' with return type bool security/apparmor/policy_unpack.c:574:8-9: WARNING: return of 0/1 in function 'unpack_secmark' with return type bool security/apparmor/policy_unpack.c:508:8-9: WARNING: return of 0/1 in function 'unpack_trans_table' with return type bool security/apparmor/policy_unpack.c:312:10-11: WARNING: return of 0/1 in function 'unpack_u32' with return type bool security/apparmor/policy_unpack.c:325:10-11: WARNING: return of 0/1 in function 'unpack_u64' with return type bool security/apparmor/policy_unpack.c:299:10-11: WARNING: return of 0/1 in function 'unpack_u8' with return type bool security/apparmor/policy_unpack.c:538:8-9: WARNING: return of 0/1 in function 'unpack_xattrs' with return type bool security/apparmor/policy_unpack.c:969:10-11: WARNING: return of 0/1 in function 'verify_dfa_xindex' with return type bool security/apparmor/policy_unpack.c:959:9-10: WARNING: return of 0/1 in function 'verify_xindex' with return type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci Fixes: 9caafbe2b4cf ("apparmor: Parse secmark policy") CC: Matthew Garrett Signed-off-by: kbuild test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next head: 566f52ece7bd1099d20dfe2f6f0801896643cf8f commit: 9caafbe2b4cf4c635826a2832e93cf648605de8b [9/16] apparmor: Parse secmark policy policy_unpack.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -239,11 +239,11 @@ static size_t unpack_u16_chunk(struct aa static bool unpack_X(struct aa_ext *e, enum aa_code code) { if (!inbounds(e, 1)) - return 0; + return false; if (*(u8 *) e->pos != code) - return 0; + return false; e->pos++; - return 1; + return true; } /** @@ -285,50 +285,50 @@ static bool unpack_nameX(struct aa_ext * /* now check if type code matches */ if (unpack_X(e, code)) - return 1; + return true; fail: e->pos = pos; - return 0; + return false; } static bool unpack_u8(struct aa_ext *e, u8 *data, const char *name) { if (unpack_nameX(e, AA_U8, name)) { if (!inbounds(e, sizeof(u8))) - return 0; + return false; if (data) *data = get_unaligned((u8 *)e->pos); e->pos += sizeof(u8); - return 1; + return true; } - return 0; + return false; } static bool unpack_u32(struct aa_ext *e, u32 *data, const char *name) { if (unpack_nameX(e, AA_U32, name)) { if (!inbounds(e, sizeof(u32))) - return 0; + return false; if (data) *data = le32_to_cpu(get_unaligned((__le32 *) e->pos)); e->pos += sizeof(u32); - return 1; + return true; } - return 0; + return false; } static bool unpack_u64(struct aa_ext *e, u64 *data, const char *name) { if (unpack_nameX(e, AA_U64, name)) { if (!inbounds(e, sizeof(u64))) - return 0; + return false; if (data) *data = le64_to_cpu(get_unaligned((__le64 *) e->pos)); e->pos += sizeof(u64); - return 1; + return true; } - return 0; + return false; } static size_t unpack_array(struct aa_ext *e, const char *name) @@ -505,12 +505,12 @@ static bool unpack_trans_table(struct aa if (!unpack_nameX(e, AA_STRUCTEND, NULL)) goto fail; } - return 1; + return true; fail: aa_free_domain_entries(&profile->file.trans); e->pos = saved_pos; - return 0; + return false; } static bool unpack_xattrs(struct aa_ext *e, struct aa_profile *profile) @@ -535,11 +535,11 @@ static bool unpack_xattrs(struct aa_ext goto fail; } - return 1; + return true; fail: e->pos = pos; - return 0; + return false; } static bool unpack_secmark(struct aa_ext *e, struct aa_profile *profile) @@ -571,7 +571,7 @@ static bool unpack_secmark(struct aa_ext goto fail; } - return 1; + return true; fail: if (profile->secmark) { @@ -582,7 +582,7 @@ fail: } e->pos = pos; - return 0; + return false; } static bool unpack_rlimits(struct aa_ext *e, struct aa_profile *profile) @@ -612,11 +612,11 @@ static bool unpack_rlimits(struct aa_ext if (!unpack_nameX(e, AA_STRUCTEND, NULL)) goto fail; } - return 1; + return true; fail: e->pos = pos; - return 0; + return false; } static u32 strhash(const void *data, u32 len, u32 seed) @@ -956,8 +956,8 @@ static bool verify_xindex(int xindex, in xtype = xindex & AA_X_TYPE_MASK; index = xindex & AA_X_INDEX_MASK; if (xtype == AA_X_TABLE && index >= table_size) - return 0; - return 1; + return false; + return true; } /* verify dfa xindexes are in range of transition tables */ @@ -966,11 +966,11 @@ static bool verify_dfa_xindex(struct aa_ int i; for (i = 0; i < dfa->tables[YYTD_ID_ACCEPT]->td_lolen; i++) { if (!verify_xindex(dfa_user_xindex(dfa, i), table_size)) - return 0; + return false; if (!verify_xindex(dfa_other_xindex(dfa, i), table_size)) - return 0; + return false; } - return 1; + return true; } /**