Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4469817rwb; Sat, 21 Jan 2023 12:38:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvBHLRo2IuxVVHh5rXhwJo/JXP/T6hRvwRjLdV+FscO33/Kf7TXnyYEe4dB5+D39ddMz/6q X-Received: by 2002:a17:902:c10d:b0:185:441e:4cfc with SMTP id 13-20020a170902c10d00b00185441e4cfcmr20299178pli.44.1674333507206; Sat, 21 Jan 2023 12:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674333507; cv=none; d=google.com; s=arc-20160816; b=FFDCwRtd/tE9lXFz6uZTiIFettoI39aRKFqWumcRN+JZk97Do/jSmCeGjZ44lBhI7O tNMZuc8RmPkjdNHNtaBUHHbl7cTas/yyIIPQYfirGKmuswj3S5L8nFl3voKALhd3Zn9m viU8hyT049gkbm4U9/2P7I1AjqYxLvJCsPqm4D+r79ksgRQ2FFG6ylpEZTAb5IKqb04N 4oPVvOdBD19sFEMvaVgOw6aS24/GqJfwOVtTEFrzv6Qy9xs9OcdLHRnT6MaQXi1LlyPc /CYxv053iUWH0jNmKKgJVFLeTJC+oAUhWDdKGAmuZ/FpSu6hOgVz/x1FD5vyJZIuLfMs jkdA== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uW1wBvzE+iJco1MK7ZyeDNOgmKvQ46N/epUU0GwORYY=; b=KdkLswwtSSJ2wRFQ+NtGQ5bw2qhqU+sV3RDBiZEd1DvPkSQm8b9RK+nZbxljemXpib +xrc+ArRuKGnJWuZezvBnmRTDw6zQwBYjMqWl9XFADD7L+8BMxxYmegTJpGNWuzRswPN vHNnalTfXanIyy2E8TeJM7m32ZrLe7gB8Z7zLgZaizBXMenjt3L83Otk0hqHwZ/nCt3w KnBHYAYq3NyFzWUiH7YKXvlHzxcaV1F7x79yFS69r2hoEznHTm2eNloqOT6Q0OyKsxV2 luKesgsAj8shodrVZ2RpX9ODuyWJwLT4KyCHAqFq7zVtKPSlRA3myWJg+840LOUFZWL8 CJKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JCzwUxp8; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a634f08000000b004b124f7a60asi43451537pgb.610.2023.01.21.12.38.14; Sat, 21 Jan 2023 12:38:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@kernel.org header.s=k20201202 header.b=JCzwUxp8; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbjAUUgn (ORCPT + 99 others); Sat, 21 Jan 2023 15:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjAUUgm (ORCPT ); Sat, 21 Jan 2023 15:36:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CB829143 for ; Sat, 21 Jan 2023 12:36:41 -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 A81AD60B6C for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70472C4339B for ; Sat, 21 Jan 2023 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674333400; bh=6vaEcMU11C00JgLvJinTeK77gDvStZvOlqFTbREyXSM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JCzwUxp8O1RrY0XzQ5C/7gJrIHHCf8jyBgR90U1nLLGr8upbLKds6GGt7zg+Slrsc WlOdC6xvOOw4QnSMb3Wrjb30k/6SvPRJ3N2wMpmolR2sihQ31MVwqjSpUYvQQ63cX1 0be6GKhf3pKlZpTmT2azYEP0ZDp7YRLZRJYovJook9uQo1M15AqeOquBxcos85oJ8i RACvb+k4fmD2IE/so4YHFLtfMUKVzWQit/NuwI/lJyG7RZN4elkpbqNSHx+P6RIUgH INHixUNzYuDdGAC9CK8n1w3rHyGqHXqvaFY/+wP9snUceth1PtgaIsJFnbivv41RG5 UcB4sxFbD51Hw== From: Eric Biggers To: linux-ext4@vger.kernel.org Subject: [PATCH 11/38] lib/blkid: suppress -Wstringop-truncation warning in blkid_strndup() Date: Sat, 21 Jan 2023 12:32:03 -0800 Message-Id: <20230121203230.27624-12-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121203230.27624-1-ebiggers@kernel.org> References: <20230121203230.27624-1-ebiggers@kernel.org> MIME-Version: 1.0 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 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-ext4@vger.kernel.org From: Eric Biggers Unfortunately, gcc gets confused by blkid_strndup() and incorrectly thinks the destination string is not being null-terminated. This is part of -Wstringop-truncation, enabled automatically by -Wall in gcc 8 and later. Let's just suppress this warning here. Signed-off-by: Eric Biggers --- lib/blkid/devno.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/blkid/devno.c b/lib/blkid/devno.c index 34ceb3c48..b1cadc9df 100644 --- a/lib/blkid/devno.c +++ b/lib/blkid/devno.c @@ -37,6 +37,12 @@ #include "blkidP.h" +#if defined(__GNUC__) && __GNUC__ >= 8 +/* gcc incorrectly thinks the destination string is not being null-terminated */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif + char *blkid_strndup(const char *s, int length) { char *ret; @@ -55,6 +61,10 @@ char *blkid_strndup(const char *s, int length) return ret; } +#if defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif + char *blkid_strdup(const char *s) { return blkid_strndup(s, 0); -- 2.39.0