From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3D29C433F5 for ; Thu, 3 Feb 2022 20:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233767AbiBCUmt (ORCPT ); Thu, 3 Feb 2022 15:42:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355773AbiBCUjH (ORCPT ); Thu, 3 Feb 2022 15:39:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB861C061370; Thu, 3 Feb 2022 12:36:16 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 58F8360A54; Thu, 3 Feb 2022 20:36:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2C32C340EB; Thu, 3 Feb 2022 20:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643920575; bh=dSVK+aJJ+YeLT75dA4xUsNw9k+1NsvmkXiPj/ke5A3o=; h=From:To:Cc:Subject:Date:From; b=lxXl3p0BuML6Pi0j+caf0bLIfXoISGmiX5Rg1s/8lyFagtcX+d819hxmyAjUXRgBD ku0B9+9jRcLJIiwCV1D4AhlOBo9LCBuMJXyUI588LPOzFRGWl/Pwo910ibxewSXi29 z4dNiFuvrVVoW/NFTetVFbiTENwDKkzvh6J1Nu4rrqWGzgvcF6nmlynNiFs9+rCwOv YXmdRRNgz6ibNNF/7X289zpFN+hGHQ5hrZe8DEjUF7QGnw5MAJwP/pHNKlsyrxFg13 I8vgaxhiRxqcFT9C0qcoTptwF4Mi5elZ2fkdA4Odn2P+9G6QBxR/FH056Ie6fx5hKw bVBTcHF4vO2wQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Olga Kornievskaia , Anna Schumaker , Sasha Levin , trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 01/10] NFSv4 only print the label when its queried Date: Thu, 3 Feb 2022 15:36:04 -0500 Message-Id: <20220203203613.4165-1-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Olga Kornievskaia [ Upstream commit 2c52c8376db7160a1dd8a681c61c9258405ef143 ] When the bitmask of the attributes doesn't include the security label, don't bother printing it. Since the label might not be null terminated, adjust the printing format accordingly. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4xdr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 0a5cae8f8aff9..8a61dc21d3d68 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -4294,10 +4294,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, } else printk(KERN_WARNING "%s: label too long (%u)!\n", __func__, len); + if (label && label->label) + dprintk("%s: label=%.*s, len=%d, PI=%d, LFS=%d\n", + __func__, label->len, (char *)label->label, + label->len, label->pi, label->lfs); } - if (label && label->label) - dprintk("%s: label=%s, len=%d, PI=%d, LFS=%d\n", __func__, - (char *)label->label, label->len, label->pi, label->lfs); return status; out_overflow: -- 2.34.1