From patchwork Tue Mar 26 22:38:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13605187 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6225813E028; Tue, 26 Mar 2024 22:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711492874; cv=none; b=isajWuSbmGMVvJV25wyB6vdZJX/Hi537+VyQKcrTgEhpHNKDQnqbFr2JCR04BIpzrHHDMBb3/j2tqwrcqxJ9xSwndyKqpYC8l568QoFm/b+7tqQVn/OTUtZqfdy83kTmcl0Ck1Azi/A8+YpR1ghOXaNTXra7kD78dShwaxA2DsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711492874; c=relaxed/simple; bh=fE8YQ0ldH4jAPvC8YbW24he4IxhcXj1g5OmwhFjAj+g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GLOPxDeMUFjWS4XdW8RmxFtfGyNbL1W0DQ/BjOh7ffpdJ2IZ9z2y8brxPXZGEX+SGkVym8WYKmg8TCPTaDqt9gFTg3mP4gx55xg+wjc0xam1gLKPQcwyfXesG/UQEhtM1bND5JQ2cH7R2NwKPwpsQTVH96JdHmtU9M2mZEB1MhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ICJtMX3p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ICJtMX3p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A94DC433F1; Tue, 26 Mar 2024 22:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711492873; bh=fE8YQ0ldH4jAPvC8YbW24he4IxhcXj1g5OmwhFjAj+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICJtMX3pCuiusynEfe3bAP6Lspz0zcyuLbBOka+EOsCaOFZME4FZ4QIKrK/MZdJmq Ctvnh5OIwUz+4zf2REjGVM2wdtuYwLoVkURryHKORb15fiwpv0FTQMJtESTGs4TGQ9 M95cMSdR9qm2j/ow8DdkaA96bSW6B+j3pXIETUi2N1JbBiGG6nS+FatuULN7WX9ApY OEQW8S0LDu+tihl3F/LXp4MYlPtjNGctBOW8AUwWSRImiBVjqWYm1AiepC0fk/OF4a ICeRLsN9MuXhJv/PBCigSpwkmoq065lOs3WVMt19zKcKFsi3X/clDOsIaByQv9Gr8K a1f7cxjjNEj7Q== From: Arnd Bergmann To: llvm@lists.linux.dev, Johannes Berg , Jaroslav Kysela , Takashi Iwai , Nathan Chancellor , Rob Herring Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Jakub Kicinski , Dawei Li , linuxppc-dev@lists.ozlabs.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/9] ALSA: aoa: avoid false-positive format truncation warning Date: Tue, 26 Mar 2024 23:38:07 +0100 Message-Id: <20240326223825.4084412-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240326223825.4084412-1-arnd@kernel.org> References: <20240326223825.4084412-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann clang warns about what it interprets as a truncated snprintf: sound/aoa/soundbus/i2sbus/core.c:171:6: error: 'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7 [-Werror,-Wformat-truncation-non-kprintf] The actual problem here is that it does not understand the special %pOFn format string and assumes that it is a pointer followed by the string "OFn", which would indeed not fit. Slightly increasing the size of the buffer to its natural alignment avoids the warning, as it is now long enough for the correct and the incorrect interprations. Fixes: b917d58dcfaa ("ALSA: aoa: Convert to using %pOFn instead of device_node.name") Signed-off-by: Arnd Bergmann --- sound/aoa/soundbus/i2sbus/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index b8ff5cccd0c8..5431d2c49421 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -158,7 +158,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, struct device_node *child, *sound = NULL; struct resource *r; int i, layout = 0, rlen, ok = force; - char node_name[6]; + char node_name[8]; static const char *rnames[] = { "i2sbus: %pOFn (control)", "i2sbus: %pOFn (tx)", "i2sbus: %pOFn (rx)" };