From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nPULD-00005r-Qp for mharc-grub-devel@gnu.org; Wed, 02 Mar 2022 14:08:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPULC-0008V5-C5 for grub-devel@gnu.org; Wed, 02 Mar 2022 14:08:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPULA-0003Z5-5U for grub-devel@gnu.org; Wed, 02 Mar 2022 14:08:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646248127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yklCsy7S68K40HWX31q4I4PgeITpnklzPGwaDFHdPAY=; b=AIqb9rEZl6d4xw8VANGzkVJkBuRBD/JICIFjpFmlF7nPtlnPm/JimFAIv6QAERc4B3uKnJ howo5gZUe8rCrFWLgFw6i9I36vnSNQjmqTimBDIA6+pnN0opM32Mk32+wuGy1FuQexuo10 d37m0kUs5PJ/+eRbUorfHtSoWNvxV/Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-vdxAAiGFNs-4XbVGoniJZA-1; Wed, 02 Mar 2022 14:08:46 -0500 X-MC-Unique: vdxAAiGFNs-4XbVGoniJZA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E9F31006AA5; Wed, 2 Mar 2022 19:08:45 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.48.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFBB760BD8; Wed, 2 Mar 2022 19:08:44 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: dkiper@net-space.pl, Robbie Harwood Subject: [PATCH v8 6/6] Handle warnings introduced by updated gnulib Date: Wed, 2 Mar 2022 14:08:29 -0500 Message-Id: <20220302190829.195337-7-rharwood@redhat.com> In-Reply-To: <20220302190829.195337-1-rharwood@redhat.com> References: <20220302190829.195337-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=rharwood@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 19:08:50 -0000 - Fix type of size variable in luks2_verify_key() - Avoid redefinition of SIZE_MAX and ATTRIBUTE_ERROR - Work around gnulib's int types on older compilers Signed-off-by: Robbie Harwood --- config.h.in | 5 +++++ grub-core/disk/luks2.c | 4 ++-- grub-core/lib/posix_wrap/limits.h | 6 +++++- include/grub/compiler.h | 4 ++-- include/grub/list.h | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/config.h.in b/config.h.in index d0f4f8609..0fca0597d 100644 --- a/config.h.in +++ b/config.h.in @@ -145,4 +145,9 @@ typedef __UINT_FAST32_TYPE__ uint_fast32_t; # define abort __builtin_trap # endif /* !_GL_INLINE_HEADER_BEGIN */ +/* gnulib doesn't build cleanly with older compilers. */ +# if __GNUC__ < 11 +_Pragma ("GCC diagnostic ignored \"-Wtype-limits\"") +# endif + #endif diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index ccfacb63a..bf741d70f 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -390,7 +390,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, { grub_uint8_t candidate_digest[GRUB_CRYPTODISK_MAX_KEYLEN]; grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN], salt[GRUB_CRYPTODISK_MAX_KEYLEN]; - grub_size_t saltlen = sizeof (salt), digestlen = sizeof (digest); + idx_t saltlen = sizeof (salt), digestlen = sizeof (digest); const gcry_md_spec_t *hash; gcry_err_code_t gcry_ret; @@ -429,7 +429,7 @@ luks2_decrypt_key (grub_uint8_t *out_key, grub_uint8_t area_key[GRUB_CRYPTODISK_MAX_KEYLEN]; grub_uint8_t salt[GRUB_CRYPTODISK_MAX_KEYLEN]; grub_uint8_t *split_key = NULL; - grub_size_t saltlen = sizeof (salt); + idx_t saltlen = sizeof (salt); char cipher[32], *p; const gcry_md_spec_t *hash; gcry_err_code_t gcry_ret; diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h index 7217138ff..26918c8a0 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -25,7 +25,11 @@ #define USHRT_MAX GRUB_USHRT_MAX #define UINT_MAX GRUB_UINT_MAX #define ULONG_MAX GRUB_ULONG_MAX -#define SIZE_MAX GRUB_SIZE_MAX + +/* gnulib also defines this type */ +#ifndef SIZE_MAX +# define SIZE_MAX GRUB_SIZE_MAX +#endif #define SCHAR_MIN GRUB_SCHAR_MIN #define SCHAR_MAX GRUB_SCHAR_MAX diff --git a/include/grub/compiler.h b/include/grub/compiler.h index 8f3be3ae7..0c5519387 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -30,10 +30,10 @@ /* Does this compiler support compile-time error attributes? */ #if GNUC_PREREQ(4,3) -# define ATTRIBUTE_ERROR(msg) \ +# define GRUB_ATTRIBUTE_ERROR(msg) \ __attribute__ ((__error__ (msg))) #else -# define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) +# define GRUB_ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) #endif #if GNUC_PREREQ(4,4) diff --git a/include/grub/list.h b/include/grub/list.h index b13acb962..21f4b4b44 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item); static inline void * grub_bad_type_cast_real (int line, const char *file) - ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); + GRUB_ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); static inline void * grub_bad_type_cast_real (int line, const char *file) -- 2.34.1