From patchwork Fri Jan 4 09:17:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 10747875 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 78D05746 for ; Fri, 4 Jan 2019 00:53:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636B52582C for ; Fri, 4 Jan 2019 00:53:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5269326E69; Fri, 4 Jan 2019 00:53:48 +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=-5.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_HI 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 8CAD12582C for ; Fri, 4 Jan 2019 00:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726347AbfADAxq (ORCPT ); Thu, 3 Jan 2019 19:53:46 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:42058 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbfADAxq (ORCPT ); Thu, 3 Jan 2019 19:53:46 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id EB3507023EC736F8EB75; Fri, 4 Jan 2019 08:53:43 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x040rcHd004679; Fri, 4 Jan 2019 08:53:38 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019010408541302-20344947 ; Fri, 4 Jan 2019 08:54:13 +0800 From: Peng Hao To: john.johansen@canonical.com, jmorris@namei.org, serge@hallyn.com Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH] security/apparmor/domain: use PTR_ERR_OR_ZERO Date: Fri, 4 Jan 2019 17:17:10 +0800 Message-Id: <1546593430-24355-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-01-04 08:54:13, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-04 08:53:23, Serialize complete at 2019-01-04 08:53:23 X-MAIL: mse01.zte.com.cn x040rcHd004679 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The variable 'new' may be NULL, so use PTR_ERR_OR_ZERO instead of PTR_ERR. Signed-off-by: Peng Hao --- security/apparmor/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 08c88de..7663589 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c @@ -1444,7 +1444,7 @@ int aa_change_profile(const char *fqname, int flags) new = aa_label_merge(label, target, GFP_KERNEL); if (IS_ERR_OR_NULL(new)) { info = "failed to build target label"; - error = PTR_ERR(new); + error = PTR_ERR_OR_ZERO(new); new = NULL; perms.allow = 0; goto audit;