Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3402948rwa; Tue, 23 Aug 2022 04:18:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6c6m4YePWO0b6dM1uwwXKlthbAJSQiXl2XuCkeJJv7DLZ8oVeoPnmFk7fTMBqAN2gp3og5 X-Received: by 2002:a17:902:f550:b0:173:c1:690e with SMTP id h16-20020a170902f55000b0017300c1690emr2471882plf.77.1661253528023; Tue, 23 Aug 2022 04:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253528; cv=none; d=google.com; s=arc-20160816; b=bvDhFYoajMRASTvsSpnfFo/1b3u+Z3qZBw2zNPOY7j1ZXZmVp7c/c1zqG5kwXivRZn 1H0z19Fb7uhKuxXIiQ03liEgKOr9CThwwTMd5b2QucS8Q8JxGxncoOvKUYIZrzJyhVfo G9B3rcvZt12HygLNDkxc8/UfAFFmZYt7kq9OOF1V0rp3t46vlSBA+NAE1OTKCOEHT6I2 rCtVdv660D+eLUxVqyGTP2hfDJB43BV+9pw2uncmQWYAbBxm6UvM0RjbBZa+fokkNorT fi/5Ffw/6FebPl/Vt9VxalApKpiVp2AvvzitgKXjAMkXT/X+2TNn1plb5JVAZ15iDK9W 5VaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fwg4SZRReoFX3bkql13mE++uIocJjnwLChUEMBHNVnk=; b=tMMe8yeETrwttXuSTDFy1xZCSPw98Wa+XwX5lr4Q3Y1Ju4eVUb9mTmkRGQrzxGxtCt HaZ5ZD+fVa41+dzE5sVerXsviOYtggTQNzccl0O8vi0DvxOZlGEDR/KH8R6wNeTJx8no uwiiFUJUxKnd6Rt9bATPQw4mS+IBi24xR6E0z5WAPXD8NdVwHk9M8dNrOiIe3JJDjbEF j2f5o63s6Y6eG/GG4ize4qJXdX6+ibCEngzTsSb5e+NPqdAIprb8f6kdyyjs8bxNcsLk D8wLtCoEE5BBD0Xg5rHy4EWgptyh1tByFqhILGWNFMbvdjS2PneNCDalMYpDL0qktzuv udpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r1iT6+oG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a170902d35200b00171230490b8si8498891plk.129.2022.08.23.04.18.35; Tue, 23 Aug 2022 04:18:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r1iT6+oG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353169AbiHWKNC (ORCPT + 99 others); Tue, 23 Aug 2022 06:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352684AbiHWKGG (ORCPT ); Tue, 23 Aug 2022 06:06:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5213EA346D; Tue, 23 Aug 2022 01:52:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8A162CE1B4A; Tue, 23 Aug 2022 08:52:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87FEFC433B5; Tue, 23 Aug 2022 08:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244741; bh=CjtXXraJnpmkjJ5WxA/lShwJHkaI3lD9zw4GIsjBwAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1iT6+oGoukfsN6aHKCqhM5tWP+YiAGxsbpmpR5OoytroDJs9qR0SdXnpqnJPEPUn n67X54ZUfY5lOzBRQM7K7/eOIhkKSJnXyZB8fTNbL9HkNWkyCiVAoj6LDOIdS1WTDH hGvXGuLNdEUh4GU5AnCqFFdpO5U6GrXRAWrQksA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , John Johansen Subject: [PATCH 4.14 183/229] apparmor: fix aa_label_asxprint return check Date: Tue, 23 Aug 2022 10:25:44 +0200 Message-Id: <20220823080100.146601150@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix commit 3e2a3a0830a2090e766d0d887d52c67de2a6f323 upstream. Clang static analysis reports this issue label.c:1802:3: warning: 2nd function call argument is an uninitialized value pr_info("%s", str); ^~~~~~~~~~~~~~~~~~ str is set from a successful call to aa_label_asxprint(&str, ...) On failure a negative value is returned, not a -1. So change the check. Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels") Signed-off-by: Tom Rix Signed-off-by: John Johansen Signed-off-by: Greg Kroah-Hartman --- security/apparmor/label.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -1722,7 +1722,7 @@ void aa_label_xaudit(struct audit_buffer if (!use_label_hname(ns, label, flags) || display_mode(ns, label, flags)) { len = aa_label_asxprint(&name, ns, label, flags, gfp); - if (len == -1) { + if (len < 0) { AA_DEBUG("label print error"); return; } @@ -1750,7 +1750,7 @@ void aa_label_seq_xprint(struct seq_file int len; len = aa_label_asxprint(&str, ns, label, flags, gfp); - if (len == -1) { + if (len < 0) { AA_DEBUG("label print error"); return; } @@ -1773,7 +1773,7 @@ void aa_label_xprintk(struct aa_ns *ns, int len; len = aa_label_asxprint(&str, ns, label, flags, gfp); - if (len == -1) { + if (len < 0) { AA_DEBUG("label print error"); return; }