Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp500943pxb; Thu, 17 Feb 2022 08:29:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNUvVTQcL1Ki45z1tp3wkJj4WMeB1UoEAfH2+kw/CqSLrLMD5FH/JG5CYMvkNYn8Lv2sYt X-Received: by 2002:a05:6402:27c7:b0:412:80f9:18af with SMTP id c7-20020a05640227c700b0041280f918afmr3464747ede.127.1645115358424; Thu, 17 Feb 2022 08:29:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645115358; cv=none; d=google.com; s=arc-20160816; b=jLlWbuys6jfgLxlPBmY7J0dWgRGiHZd7/CgSHe3ugetI8Yofhl7g9XoKFoXncf9aUQ ou3+wT6Ru/g2wRTevEaft7VlGXyO4CmFLozQTmaV0MkLSCYeqsTsPPB5kP3uVTZWJfWj f5uL2scX21W+L0xC72ueEu/CCmyJrOClHaHjxQ9wkHs3RUt5yhU800Ql3yN9QfoJmoNV ThX26tidQnGZfGMNdKPVfCoYh+/jfVxveGuXLX1AY8IZm98xjl0VMz8ng88Ijm2V7FE/ xdxcc45cFzUwBzmh4WIWSvJD/MteESYeqVG2sh/GppjcMUMPvBWsm2Wj8sym3fKSkRke HXfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EuHmUQyH6qnHd858RqknP0s0QcJF0aPYhchgl7zVC2A=; b=TI05KgSGgzv+vqxV4zNAgOQ8pKH7TAcyKBLkwpEdkeEZXrjlz9EcZofRbKGr8tH8ep EvA//xs7/I6phcuY6Z8Hm7HZ6pSo+Df+xri9EI12dpnGuXSPlj+zGCFALDqmFnAw+iMr 8cBtdhOMJo2/b3z4FQKpfsMPCrPItdEEjZpTw578aX1QIwUKSXXV3PBJ7f8vGWFNWgo8 8vVJwjgrXkHu4tVx9WyQkbsu0dZtfv8fvIxAYQ8kdU/KEdYV9qjTwBWxXv1Wrdz5wDSg 4cyrUPf756WlPZGIBMAiD7mfyZ0B2MCqgRIdZEhGY8UtDYPBOwKmXt5tdjsz82+AI9r8 BwIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b="a/cRpJjY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw13si2478832ejc.764.2022.02.17.08.28.49; Thu, 17 Feb 2022 08:29:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b="a/cRpJjY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241821AbiBQOWI (ORCPT + 99 others); Thu, 17 Feb 2022 09:22:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241834AbiBQOWD (ORCPT ); Thu, 17 Feb 2022 09:22:03 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C2D294133; Thu, 17 Feb 2022 06:21:48 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id vz16so7807550ejb.0; Thu, 17 Feb 2022 06:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EuHmUQyH6qnHd858RqknP0s0QcJF0aPYhchgl7zVC2A=; b=a/cRpJjYorSNEhv8rgzuuwu8DtqJBBjyo6H/urhBzQeA8gCrmajvBkEHM7if60gNmo 2UhRRWooKMiMJ9joFoQRdXTMAQZCrFUroZuBnUTi0oYCGwMI792kPeYppaccmY0thftX LXMC0uCUt4Xyw5YvGFTzgxlZ/kWlk7UGIiXXLxekUjCJq3XUFmBiDj3yW+zTLDPQ4N5R gp6aGQvov4zzK47ZsNnCDl+9ZRn7LURFYAk8JqeVI5jY3tdS5ZZraNv8t3BISmCWvAax 49qJ5LTGcp9GKqPzdNnrQiJaiwl2Slcuh+0Md+vvG3fCAs/1SFNYVZF5za0LSllI7RjJ FYXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EuHmUQyH6qnHd858RqknP0s0QcJF0aPYhchgl7zVC2A=; b=mniax30NFeTvOdghrrIq6BeNJQVq7wmzggd3PHnwyxvw4n5w5rRkUzDD9pt1ERU42U PcFS0mMblOy7bkRnWXWIR7Kg167lj45b3HScKWNi555XGCkTwy5Bb5BKjg9lUbV6TC8E I/Y89GozK5RRAkiLz/FOyXpTCOHicr3KxKJEDuytBhRJ5wGUS9VpxRpiUHw/vz9idBZp qs1rF8q9+iUsrkTkp1OS6l+clEv90AwtGECw12jNHyc9J8EDIGSdZWFj20RS7ncWKRPQ 6CXOmrx61wFb+10E1KavkRyO5LWJxV3bBVW5YuiMnqBGEu5byJ6yw4y3EgcSH8pb0hzV coDQ== X-Gm-Message-State: AOAM531QMBoht7wD4sNeydCJq1xM4phWWiTNFyl+XUvJoloO1M2Z++Hy VsWaiCwnGv534xul43dbKDFuH+ow9LVY4A== X-Received: by 2002:a17:907:9956:b0:6b9:a6d9:a535 with SMTP id kl22-20020a170907995600b006b9a6d9a535mr2533960ejc.64.1645107706743; Thu, 17 Feb 2022 06:21:46 -0800 (PST) Received: from debianHome.localdomain (dynamic-077-001-066-240.77.1.pool.telefonica.de. [77.1.66.240]) by smtp.gmail.com with ESMTPSA id a13sm578436edn.25.2022.02.17.06.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 06:21:46 -0800 (PST) From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Paul Moore , Stephen Smalley , Eric Paris , Nathan Chancellor , Nick Desaulniers , Ondrej Mosnacek , James Morris , Austin Kim , Casey Schaufler , Jiapeng Chong , Yang Li , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 3/5] selinux: use consistent pointer types for boolean arrays Date: Thu, 17 Feb 2022 15:21:26 +0100 Message-Id: <20220217142133.72205-2-cgzones@googlemail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220217142133.72205-1-cgzones@googlemail.com> References: <20220217142133.72205-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use a consistent type of unsigned int* for boolean arrays, instead of using implicit casts to and from int*. Reported by sparse: security/selinux/selinuxfs.c:1481:30: warning: incorrect type in assignment (different signedness) security/selinux/selinuxfs.c:1481:30: expected unsigned int * security/selinux/selinuxfs.c:1481:30: got int *[addressable] values security/selinux/selinuxfs.c:1398:48: warning: incorrect type in argument 3 (different signedness) security/selinux/selinuxfs.c:1398:48: expected int *values security/selinux/selinuxfs.c:1398:48: got unsigned int *bool_pending_values Signed-off-by: Christian Göttsche --- A more invasive change would be to change all boolean arrays to bool*. --- security/selinux/include/conditional.h | 4 ++-- security/selinux/selinuxfs.c | 2 +- security/selinux/ss/services.c | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/security/selinux/include/conditional.h b/security/selinux/include/conditional.h index b09343346e3f..9e65aa409318 100644 --- a/security/selinux/include/conditional.h +++ b/security/selinux/include/conditional.h @@ -14,9 +14,9 @@ #include "security.h" int security_get_bools(struct selinux_policy *policy, - u32 *len, char ***names, int **values); + u32 *len, char ***names, unsigned int **values); -int security_set_bools(struct selinux_state *state, u32 len, int *values); +int security_set_bools(struct selinux_state *state, u32 len, unsigned int *values); int security_get_bool_value(struct selinux_state *state, u32 index); diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index f2f6203e0fff..5216a321bbb0 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -1428,7 +1428,7 @@ static int sel_make_bools(struct selinux_policy *newpolicy, struct dentry *bool_ struct inode_security_struct *isec; char **names = NULL, *page; u32 i, num; - int *values = NULL; + unsigned int *values = NULL; u32 sid; ret = -ENOMEM; diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 6901dc07680d..7865926962ab 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -3023,7 +3023,7 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) } int security_get_bools(struct selinux_policy *policy, - u32 *len, char ***names, int **values) + u32 *len, char ***names, unsigned int **values) { struct policydb *policydb; u32 i; @@ -3045,7 +3045,7 @@ int security_get_bools(struct selinux_policy *policy, goto err; rc = -ENOMEM; - *values = kcalloc(*len, sizeof(int), GFP_ATOMIC); + *values = kcalloc(*len, sizeof(unsigned int), GFP_ATOMIC); if (!*values) goto err; @@ -3075,7 +3075,7 @@ int security_get_bools(struct selinux_policy *policy, } -int security_set_bools(struct selinux_state *state, u32 len, int *values) +int security_set_bools(struct selinux_state *state, u32 len, unsigned int *values) { struct selinux_policy *newpolicy, *oldpolicy; int rc; @@ -3175,7 +3175,8 @@ int security_get_bool_value(struct selinux_state *state, static int security_preserve_bools(struct selinux_policy *oldpolicy, struct selinux_policy *newpolicy) { - int rc, *bvalues = NULL; + int rc; + unsigned int *bvalues = NULL; char **bnames = NULL; struct cond_bool_datum *booldatum; u32 i, nbools = 0; -- 2.35.1