From patchwork Tue Sep 19 01:56:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li kunyu X-Patchwork-Id: 141652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3075190vqi; Mon, 18 Sep 2023 18:58:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1UQFPUEw1tp0GSA5DKKCxM0aN9Gssre+WbzXI4NVgvtABeN4jLoiJlHcKMYDFWUV6f878 X-Received: by 2002:a05:6a00:80c2:b0:68f:a92a:8509 with SMTP id ei2-20020a056a0080c200b0068fa92a8509mr1472696pfb.7.1695088702905; Mon, 18 Sep 2023 18:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695088702; cv=none; d=google.com; s=arc-20160816; b=VmEYqZiSO3R5rWyh3xVFloyyMFxu8aFEJsbVyg2OTPjuX7zOtcsZZFndDXaHEavpNE cP26EHgDcgYazgCgW8c4g4v/SXPT1dSFyx4Ezqff5fdvCqP+NcRZFMSf5QZBX+R/9myS jRXiutM5LYc/cOZp8T5VfquhF06VX7D4XGu8UJLhQwuCrLQKTvygjVtu2/NXUupMCwy+ KkMe7G4ku2Y+TkcYrAzinurvUSLM0ZsTLd+E5dunE7Kd+CNCtYMhxOENDpnxjFY5EMj1 3Licpo7CcWtuZRwKvmDppJbR2QqzCDEYe25Wnz+grqZghOxo6Ayd18K/NWVqQoXlcp9w tcUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=czO1Z5nVJujfyUG8BSjIp3qtOXTcZ79RuU+W2i7VW5U=; fh=OF3ARR+5xO6WiUJQqaqEUeBC5yKHa1WNFEYzDffdDqA=; b=IQMhioUILRIkD9dNkgE3FQkmVIQg75NmrQwf51SzqLxgOF+p6OY3/6sU+bLgSY5W/x DgqqW0Vn2h/F+hPOnDmG49BdklJaEZeQhhapEDINpDElJ3i4uJTbJGKQrV7M1DzISv+P G+pZuqowM1Hp1QggOIrbKzmTE55OogdutYbPY2AQ0oAlLg8oOCLFwcXbS+UVbvjUelFb rYedTzmaG9gDIlo4WULkQY7b6DbwAUDu3ZFIJjg67zwKKRai4lxyVOHAe8tzpguX6ei+ L7oLTp1KibNiDQechwgky8lxTKYaG1BCroOR2ekez4nZyoRiolMKaamL4xBMWuLMOvSW gAoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ce7-20020a056a002a0700b0068e2d888713si8695645pfb.167.2023.09.18.18.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 18:58:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 25CBD818239F; Mon, 18 Sep 2023 18:57:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbjISB4v (ORCPT + 26 others); Mon, 18 Sep 2023 21:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjISB4u (ORCPT ); Mon, 18 Sep 2023 21:56:50 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 87AE794; Mon, 18 Sep 2023 18:56:44 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 76CBC60292B81; Tue, 19 Sep 2023 09:56:25 +0800 (CST) X-MD-Sfrom: kunyu@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li kunyu To: john.johansen@canonical.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Li kunyu Subject: [PATCH v2] apparmor/file: Removing unnecessary initial values for variable pointers Date: Tue, 19 Sep 2023 09:56:08 +0800 Message-Id: <20230919015608.8390-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 18 Sep 2023 18:57:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777429331556289857 X-GMAIL-MSGID: 1777429331556289857 These variable pointers are assigned during use and do not need to be initialized for assignment. Signed-off-by: Li kunyu --- v2: Fix timestamp issues security/apparmor/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/apparmor/file.c b/security/apparmor/file.c index 698b124e649f..12eafdf18fc0 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c @@ -264,7 +264,7 @@ int aa_path_perm(const char *op, struct aa_label *label, { struct aa_perms perms = {}; struct aa_profile *profile; - char *buffer = NULL; + char *buffer; int error; flags |= PATH_DELEGATE_DELETED | (S_ISDIR(cond->mode) ? PATH_IS_DIR : @@ -412,7 +412,7 @@ int aa_path_link(struct aa_label *label, struct dentry *old_dentry, d_backing_inode(old_dentry)->i_uid, d_backing_inode(old_dentry)->i_mode }; - char *buffer = NULL, *buffer2 = NULL; + char *buffer, *buffer2; struct aa_profile *profile; int error;