Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5419448imm; Tue, 19 Jun 2018 10:04:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK9cCgxqTMZGznBBibLz7oK+sLph5EaXHfpLjP3T3e4EkJe+thdLWxS4qXmaWWPN4BBsZs2 X-Received: by 2002:a62:df12:: with SMTP id u18-v6mr19010016pfg.230.1529427898845; Tue, 19 Jun 2018 10:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529427898; cv=none; d=google.com; s=arc-20160816; b=XoQr6IbDGUl3tuKcM+4j+SGWmWJDdN5dqJEsGTehvHCyymL1d7vCFTnMOn3NLQpRk8 /dgoydjYe8aXdfyF1ePBauDY9I2BiAJrIdwDwQhvv4YhroEVtLLSk8MF2skM+a4cq8j1 DI3NEvUWcz7S3JHNyrKaNQDasywnXkHGMcnYnLVkPx3yiXwrMwZpqV39GxCkTH0xZmKR ohvLeg9ERGJPlkhUYryDHe2uth9JjMHftniPvvhy7ah3u8uO2pCPGK3E0UOadUOJA2Oj aU4Zzv7iIJgoZIc/rzJgdsq3ovopEeWtxp6tGPhokCsQlAdytTyIHdgeIsQXH7/6jMZ1 KaOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=9p3o9s3onXhDmRXd24tzo87bzE4P0QuQR/4h0T0p/KI=; b=LH9ppQTumqJ3d9WrIs8x8R393wbfuWIHYpqa1Mion2+2b/WNxeIlG/e2r2V5uSary/ MoWEu+7RdbRWCp4KtN4Z2d/SXp9pSLjxNMyHe0vN6yUXHQ1cOqqsExQuFZ2eePI78SZE wzVdSk8z//PBAFpUuwOm4QPXzSZDd5i2rFCgdXZWlDmv38UmUV/1Q4OW0QxqMhLe4yGB jNCrr5NeASfAIa1j47zpOeS4Vj45ZHTbk7l1Gz+xaTD+foo/VpyoD38eBPJd30bMDdJW 8Qa019OV1roVZ2bQxlwRrOiWsvM+EHOVz888KTUcFepsYQjT5DYueKRUhR/1SM7AxuWl jOhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=mFGLBY2F; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si164005pln.349.2018.06.19.10.04.44; Tue, 19 Jun 2018 10:04: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; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=mFGLBY2F; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030276AbeFSRDg (ORCPT + 99 others); Tue, 19 Jun 2018 13:03:36 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:43989 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966449AbeFSRDa (ORCPT ); Tue, 19 Jun 2018 13:03:30 -0400 Received: by mail-lf0-f66.google.com with SMTP id x13-v6so562879lff.10 for ; Tue, 19 Jun 2018 10:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9p3o9s3onXhDmRXd24tzo87bzE4P0QuQR/4h0T0p/KI=; b=mFGLBY2FdTHSrQhiFcuvNLN99FnGRJKAEkkJ6n67fbS4OQB2T8W0IuvRa4cLjidiWo 0DWesAD5/kS0gy088oM9JTv1lmhInwzTcjAme+kCp0n1D7U5BNenwOD+vABrHcdWJKEO 2otHsryW7B9LsuoA6vH3loB5tep9kMmKDQkTo2hvoOrBbG1LPW59Lo7516jhMD8AIxZm MSh5KnayEpP1oE0uP5eltnZdk0gSCZDxC/tbtM+9BgQMhx5nQrrzh6gRoaYHneh1vPPk Dd0KxszZ9Epq0rjvoX4LG3RNXdygdrQvD/zg1aS3TZ2/MfWIMe63MZdDjTKBtSY5o8ED Qzjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9p3o9s3onXhDmRXd24tzo87bzE4P0QuQR/4h0T0p/KI=; b=ttlnGP2msZ+iHov2AT4Fqgc1DN+jMizRJ7Y464s0jjJMt6Rp1nLO1x3sq/hi9VCmGV uBd5lafiDt8+R+bhOOjZZ2g3uSxdqOEZ938ngsnIfv8ZwEv+HdMaHk0ZdI5rWNIFi4Yi r+5jaBKEQJs91sbU/Fj2HqdmgNhXhkZ1kLBJ0wO/SmIb9a0IkAlCSVs9TPlijCxjFP3N tXDk8aXNxAWQeA7uX93W8P876exIvoDeX3qM7rPoPMfvHzhxBEtdgFZVNHbXu/oNyb4Q anJq9eBBpQkDWCk6yFv685ATo2ikIqb3jQwHnC/1I4KAaIzM4Iq3B32wFxgj+JBjQWP+ Rgpw== X-Gm-Message-State: APt69E0/U6vRp5iyH90jJ4hDkyXAK2/yZgvmgjt9Ccq202eIyMLNHGN5 sV1EMeHXZ86+Wv8N5drQ+X687NwMJeQkPWUrJfGS X-Received: by 2002:a2e:4d0e:: with SMTP id a14-v6mr12141128ljb.106.1529427809021; Tue, 19 Jun 2018 10:03:29 -0700 (PDT) MIME-Version: 1.0 References: <20180612080912.7827-1-peter.enderborg@sony.com> <20180612080912.7827-6-peter.enderborg@sony.com> In-Reply-To: <20180612080912.7827-6-peter.enderborg@sony.com> From: Paul Moore Date: Tue, 19 Jun 2018 13:03:18 -0400 Message-ID: Subject: Re: [PATCH 05/13] selinux: Cleanup printk logging in avtab To: peter.enderborg@sony.com Cc: Stephen Smalley , Eric Paris , James Morris , danielj@mellanox.com, dledford@redhat.com, selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, serge@hallyn.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 12, 2018 at 4:09 AM Peter Enderborg wrote: > > Replace printk with pr_* to avoid checkpatch warnings. > > Signed-off-by: Peter Enderborg > --- > security/selinux/ss/avtab.c | 51 +++++++++++++++++++++++---------------------- > 1 file changed, 26 insertions(+), 25 deletions(-) Merged, thanks. > diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c > index a2c9148b0662..c0417cf17fee 100644 > --- a/security/selinux/ss/avtab.c > +++ b/security/selinux/ss/avtab.c > @@ -338,7 +338,7 @@ int avtab_alloc(struct avtab *h, u32 nrules) > h->nel = 0; > h->nslot = nslot; > h->mask = mask; > - printk(KERN_DEBUG "SELinux: %d avtab hash slots, %d rules.\n", > + pr_debug("SELinux: %d avtab hash slots, %d rules.\n", > h->nslot, nrules); > return 0; > } > @@ -368,7 +368,7 @@ void avtab_hash_eval(struct avtab *h, char *tag) > } > } > > - printk(KERN_DEBUG "SELinux: %s: %d entries and %d/%d buckets used, " > + pr_debug("SELinux: %s: %d entries and %d/%d buckets used, " > "longest chain length %d sum of chain length^2 %llu\n", > tag, h->nel, slots_used, h->nslot, max_chain_len, > chain2_len_sum); > @@ -407,18 +407,18 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > if (vers < POLICYDB_VERSION_AVTAB) { > rc = next_entry(buf32, fp, sizeof(u32)); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > items2 = le32_to_cpu(buf32[0]); > if (items2 > ARRAY_SIZE(buf32)) { > - printk(KERN_ERR "SELinux: avtab: entry overflow\n"); > + pr_err("SELinux: avtab: entry overflow\n"); > return -EINVAL; > > } > rc = next_entry(buf32, fp, sizeof(u32)*items2); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > items = 0; > @@ -426,19 +426,19 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > val = le32_to_cpu(buf32[items++]); > key.source_type = (u16)val; > if (key.source_type != val) { > - printk(KERN_ERR "SELinux: avtab: truncated source type\n"); > + pr_err("SELinux: avtab: truncated source type\n"); > return -EINVAL; > } > val = le32_to_cpu(buf32[items++]); > key.target_type = (u16)val; > if (key.target_type != val) { > - printk(KERN_ERR "SELinux: avtab: truncated target type\n"); > + pr_err("SELinux: avtab: truncated target type\n"); > return -EINVAL; > } > val = le32_to_cpu(buf32[items++]); > key.target_class = (u16)val; > if (key.target_class != val) { > - printk(KERN_ERR "SELinux: avtab: truncated target class\n"); > + pr_err("SELinux: avtab: truncated target class\n"); > return -EINVAL; > } > > @@ -446,16 +446,16 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > enabled = (val & AVTAB_ENABLED_OLD) ? AVTAB_ENABLED : 0; > > if (!(val & (AVTAB_AV | AVTAB_TYPE))) { > - printk(KERN_ERR "SELinux: avtab: null entry\n"); > + pr_err("SELinux: avtab: null entry\n"); > return -EINVAL; > } > if ((val & AVTAB_AV) && > (val & AVTAB_TYPE)) { > - printk(KERN_ERR "SELinux: avtab: entry has both access vectors and types\n"); > + pr_err("SELinux: avtab: entry has both access vectors and types\n"); > return -EINVAL; > } > if (val & AVTAB_XPERMS) { > - printk(KERN_ERR "SELinux: avtab: entry has extended permissions\n"); > + pr_err("SELinux: avtab: entry has extended permissions\n"); > return -EINVAL; > } > > @@ -470,7 +470,8 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > } > > if (items != items2) { > - printk(KERN_ERR "SELinux: avtab: entry only had %d items, expected %d\n", items2, items); > + pr_err("SELinux: avtab: entry only had %d items, expected %d\n", > + items2, items); > return -EINVAL; > } > return 0; > @@ -478,7 +479,7 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > > rc = next_entry(buf16, fp, sizeof(u16)*4); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > > @@ -491,7 +492,7 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > if (!policydb_type_isvalid(pol, key.source_type) || > !policydb_type_isvalid(pol, key.target_type) || > !policydb_class_isvalid(pol, key.target_class)) { > - printk(KERN_ERR "SELinux: avtab: invalid type or class\n"); > + pr_err("SELinux: avtab: invalid type or class\n"); > return -EINVAL; > } > > @@ -501,13 +502,13 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > set++; > } > if (!set || set > 1) { > - printk(KERN_ERR "SELinux: avtab: more than one specifier\n"); > + pr_err("SELinux: avtab: more than one specifier\n"); > return -EINVAL; > } > > if ((vers < POLICYDB_VERSION_XPERMS_IOCTL) && > (key.specified & AVTAB_XPERMS)) { > - printk(KERN_ERR "SELinux: avtab: policy version %u does not " > + pr_err("SELinux: avtab: policy version %u does not " > "support extended permissions rules and one " > "was specified\n", vers); > return -EINVAL; > @@ -515,17 +516,17 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > memset(&xperms, 0, sizeof(struct avtab_extended_perms)); > rc = next_entry(&xperms.specified, fp, sizeof(u8)); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > rc = next_entry(&xperms.driver, fp, sizeof(u8)); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > rc = next_entry(buf32, fp, sizeof(u32)*ARRAY_SIZE(xperms.perms.p)); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > for (i = 0; i < ARRAY_SIZE(xperms.perms.p); i++) > @@ -534,14 +535,14 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, > } else { > rc = next_entry(buf32, fp, sizeof(u32)); > if (rc) { > - printk(KERN_ERR "SELinux: avtab: truncated entry\n"); > + pr_err("SELinux: avtab: truncated entry\n"); > return rc; > } > datum.u.data = le32_to_cpu(*buf32); > } > if ((key.specified & AVTAB_TYPE) && > !policydb_type_isvalid(pol, datum.u.data)) { > - printk(KERN_ERR "SELinux: avtab: invalid type\n"); > + pr_err("SELinux: avtab: invalid type\n"); > return -EINVAL; > } > return insertf(a, &key, &datum, p); > @@ -562,12 +563,12 @@ int avtab_read(struct avtab *a, void *fp, struct policydb *pol) > > rc = next_entry(buf, fp, sizeof(u32)); > if (rc < 0) { > - printk(KERN_ERR "SELinux: avtab: truncated table\n"); > + pr_err("SELinux: avtab: truncated table\n"); > goto bad; > } > nel = le32_to_cpu(buf[0]); > if (!nel) { > - printk(KERN_ERR "SELinux: avtab: table is empty\n"); > + pr_err("SELinux: avtab: table is empty\n"); > rc = -EINVAL; > goto bad; > } > @@ -580,9 +581,9 @@ int avtab_read(struct avtab *a, void *fp, struct policydb *pol) > rc = avtab_read_item(a, fp, pol, avtab_insertf, NULL); > if (rc) { > if (rc == -ENOMEM) > - printk(KERN_ERR "SELinux: avtab: out of memory\n"); > + pr_err("SELinux: avtab: out of memory\n"); > else if (rc == -EEXIST) > - printk(KERN_ERR "SELinux: avtab: duplicate entry\n"); > + pr_err("SELinux: avtab: duplicate entry\n"); > > goto bad; > } > -- > 2.15.1 > -- paul moore www.paul-moore.com