Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3181904ybt; Mon, 22 Jun 2020 17:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1+GqqeQBXLQxrfUnuwpbqbeiaAnS8AqCSHj1X6bPGIQKYojbcmO58pun1mcOykMVJ2cfJ X-Received: by 2002:a17:906:6897:: with SMTP id n23mr18621515ejr.437.1592872672793; Mon, 22 Jun 2020 17:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592872672; cv=none; d=google.com; s=arc-20160816; b=n8lDf2io0/YuBpeUkf3/aYHNFqeuqT2v50R3c5PIMxCwn6YG4+Wc3wTuhYtd358JC9 9t4DtjjunY/Z8BdGuOsWx8I1LF57Hhk9e+GYPC4jvE3af9fHDXrWEbRkWk03Y4HLvhmh P9da9ikLiZCafyCFijEVGDE8kWK3C4wsL4ngdnd32v+S4HRqjz3mwsukzXT3fnXjKn2m sqnYuvOJbh/pyLRPzSD85sdw5b6mQInsfIn9EZZWnWbpBrIGimNBRfKtkNU1fK1kf7YB OMT8N/vKS7B9V8HvgXxf3PvvYyjynNFynAiUpcxRP6uQhjdla7CLi3NK0hZumdyu2Ax1 C6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=4WeD0C27mVX0onraF5izAXrMPG9y5qT1kwgv9gWu4gA=; b=i0cNIeqU7Z0s4f6BJ6YaGujwSZ0WBpxjX45NE6VEpj5KLqH8RHunqOeOLH3xC9FlO/ DDY+U6+y4btZ+Othu765Wj1Z9J+ZlBgXesgdpbywKuaLMH46TDIstWOKH2uOrqzHXYDA QvvIlanqDV1s7jyDUUJuwVBFPyrigJNwlftxI1MrEm1/m7nhOiR1f6NfIA85dn20c7z9 7DhwdkdGsO4itX1n1dY5NGW4TtzmGpA+CE87WQp2/Ovbu9M45YhuxW9GrwyNM/59fwVB 25TbVh1NlPatJXC+ZJ8MSJgKq+SsBwG0Szind1+NuZvBStfPaH66rf0L50TGtTRaZOTo U/bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=bSxy2P2Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si9841695ejm.315.2020.06.22.17.37.29; Mon, 22 Jun 2020 17:37:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=bSxy2P2Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732025AbgFWAe2 (ORCPT + 99 others); Mon, 22 Jun 2020 20:34:28 -0400 Received: from linux.microsoft.com ([13.77.154.182]:47558 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732017AbgFWAe0 (ORCPT ); Mon, 22 Jun 2020 20:34:26 -0400 Received: from sequoia.work.tihix.com (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id F378420B4780; Mon, 22 Jun 2020 17:34:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F378420B4780 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1592872465; bh=4WeD0C27mVX0onraF5izAXrMPG9y5qT1kwgv9gWu4gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSxy2P2YWMR35RPL5XjOzKnQdFN0xghqqr00ABvR6u2xQxytt5BDMXy1jt3vhUxjr YbsdCtO/CeyQ+cR6K2n8wHLqLYyD3alGMF6tuSFET5QTzo0K/rjxWfBK404z54j5C7 wEQyuORzDE7/t24/56f64c/KVUCGopMjFRGpaMLw= From: Tyler Hicks To: Mimi Zohar , Dmitry Kasatkin Cc: James Morris , "Serge E . Hallyn" , Lakshmi Ramasubramanian , Prakhar Srivastava , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH 09/12] ima: Use correct type for the args_p member of ima_rule_entry.lsm elements Date: Mon, 22 Jun 2020 19:32:33 -0500 Message-Id: <20200623003236.830149-10-tyhicks@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200623003236.830149-1-tyhicks@linux.microsoft.com> References: <20200623003236.830149-1-tyhicks@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make args_p be of the char pointer type rather than have it be a void pointer that gets casted to char pointer when it is used. It is a simple NUL-terminated string as returned by match_strdup(). Signed-off-by: Tyler Hicks --- security/integrity/ima/ima_policy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index e9c7d318fdd4..514baf24d6a5 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -74,7 +74,7 @@ struct ima_rule_entry { int pcr; struct { void *rule; /* LSM file metadata specific */ - void *args_p; /* audit value */ + char *args_p; /* audit value */ int type; /* audit type */ } lsm[MAX_LSM_RULES]; char *fsname; @@ -315,7 +315,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry) &nentry->lsm[i].rule); if (!nentry->lsm[i].rule) pr_warn("rule for LSM \'%s\' is undefined\n", - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); } /* Disown all references that were shallow copied */ @@ -917,7 +917,7 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry, &entry->lsm[lsm_rule].rule); if (!entry->lsm[lsm_rule].rule) { pr_warn("rule for LSM \'%s\' is undefined\n", - (char *)entry->lsm[lsm_rule].args_p); + entry->lsm[lsm_rule].args_p); if (ima_rules == &ima_default_rules) { kfree(entry->lsm[lsm_rule].args_p); @@ -1666,27 +1666,27 @@ int ima_policy_show(struct seq_file *m, void *v) switch (i) { case LSM_OBJ_USER: seq_printf(m, pt(Opt_obj_user), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; case LSM_OBJ_ROLE: seq_printf(m, pt(Opt_obj_role), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; case LSM_OBJ_TYPE: seq_printf(m, pt(Opt_obj_type), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; case LSM_SUBJ_USER: seq_printf(m, pt(Opt_subj_user), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; case LSM_SUBJ_ROLE: seq_printf(m, pt(Opt_subj_role), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; case LSM_SUBJ_TYPE: seq_printf(m, pt(Opt_subj_type), - (char *)entry->lsm[i].args_p); + entry->lsm[i].args_p); break; } seq_puts(m, " "); -- 2.25.1