From patchwork Tue Aug 13 19:21:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE1CC746 for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F855204FA for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93E6128706; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41450204FA for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbfHMTVl (ORCPT ); Tue, 13 Aug 2019 15:21:41 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:42962 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfHMTVl (ORCPT ); Tue, 13 Aug 2019 15:21:41 -0400 Received: by mail-pg1-f201.google.com with SMTP id l12so20334852pgt.9 for ; Tue, 13 Aug 2019 12:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=2aeEBz56zRddyxSHEez5i69GNQI42igiq+SaDdsB6Ys=; b=bAjrzwoQGLXXppXDgT1dxNMrO7zA3yo9e9wBbiGcQnDnh1iPyU91k28VYNewazRLSf ZOtdqhLHeInuBANqoCsMnjNliTDxWjXstFUmwsNhlMpkbIp3dkzwnIBWNhc2I69gzy0U FyUA9ui/MEV5MXvtHLHNVjApIu+vJGnOfrfTL99z3c+L7upxUenxzd7rIbMKdnnm9w5R y5GSZ3D9jgcfICXGBiMrbNQvua+3xm4UYhUFkZ7Nl/QqPzX6HEwnlns+Ort6J/aBQ5C+ ycmAIT7zwNbGra6eHI2eeGClcs9CRMrvzcHjk8dkwopMifkaKFNtWWHePep0QjyfoBZD ZN+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=2aeEBz56zRddyxSHEez5i69GNQI42igiq+SaDdsB6Ys=; b=kaZMPIBrCDzmZo43OUyj8J7EGz99UZY0Ls/OuZxNOF16e35V7R6M5I0sdIE/g3aos5 ryMU6IlAy0/9SkELKaLTeAwIKrORXQui9vpKnjuCv3Cx0wlXXLAc5F63LUkXTzoCoQiz TqLKcufBPNX/+6MxUm0qQLPkda6GZAllLtRUN5LuIo9bHsk8SQa+TR9Vrzrp5jpWRGBN 6wLtlSIegm2xEbXKKlw3pUHGiys5BiNLMsjMraFGjfM/d7wAtBWCvjBI3VcNvx91Ox3+ 60HnnoTeeY8djiNpCAv8Ud2gv3aCUNI5PQXYCz/O1LcIEcSA6z7VVLXlh4s+3w2PiRY2 kS1w== X-Gm-Message-State: APjAAAXtCut/BgehJ/WaBKuWkIBWrNm4PF/AP4CHFpjDgBFU+80pyNRW BCnb5YRinBK1OGXprXI4LEL4wD5EDv2I+SLCgYiBJw== X-Google-Smtp-Source: APXvYqzU/oWYR4SKCCMM79/8zpON6iCEKCZfRVjunNBBQ1kH+u74smlApXRqpqBuAVa78xnFquFZ7nFtsf8MJucMpmvFGA== X-Received: by 2002:a65:620a:: with SMTP id d10mr35199635pgv.8.1565724100334; Tue, 13 Aug 2019 12:21:40 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:24 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-5-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 4/6] security: fix ptr_ret.cocci warnings From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, kbuild test robot , Matthew Garrett Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: kbuild test robot security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Fixes: 80d14015a8e3 ("security: Add a static lockdown policy LSM") Signed-off-by: kbuild test robot Signed-off-by: Matthew Garrett --- security/lockdown/lockdown.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c index f6c74cf6a798..0068cec77c05 100644 --- a/security/lockdown/lockdown.c +++ b/security/lockdown/lockdown.c @@ -176,10 +176,7 @@ static int __init lockdown_secfs_init(void) dentry = securityfs_create_file("lockdown", 0600, NULL, NULL, &lockdown_ops); - if (IS_ERR(dentry)) - return PTR_ERR(dentry); - - return 0; + return PTR_ERR_OR_ZERO(dentry); } core_initcall(lockdown_secfs_init);