From patchwork Fri Nov 1 06:14:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 178246 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp37224ill; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA2+U3BuTU3lkl+vRu3wVYgGY5hhMQ7i7dSlZ4kid90dotUhyu8U+E+PxgqKqVVd1AtHXD X-Received: by 2002:aa7:d4d8:: with SMTP id t24mr729531edr.40.1572588981075; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572588981; cv=none; d=google.com; s=arc-20160816; b=X0NrbpGpicKn38NVu4AZvJ5WuKCZPDYCmsCfnFbAVybF7R31BZq8mTj1DNA6KmKj74 gbRDtE/h1ARqfaOaBQakCERPzHHm7axO4QfHH9CQLXC6M3w0S6Xmziu0V1Gdprk7A7tS tGpM35OCpZxCKyQ8+NXhxjAkzcyiJQDex1+Tr0O4F49+AYSTLH3cm1CkK2JnatUTFvMZ PZCRY1zQjvoeDFWUsZJJi9+OmKp+ANg9EmDGBc91znrlTBITK0In/E3N25lfIWcCgxUI hddzZXXybJibrSx2GH1vUqO06Ort2HryxE40jcUWJUDAyMm8zU6ltTZRMJAW57H3fxUn A4yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=EbWxLFiY8h504jFBt4i5+hTSLW7vcJ0MI7MXhe5UQ4A=; b=L9MbavG8gwPmhRgCP+8SLnU9vJ8u0kqGzZqWNkO32Cei0OXcv4Pt/LLkYxp086SAoD pes7Hhtx7ggCEKRV5DIx6vuZA7aPWIfWYLdWKIf+2xnBt7HRpUcWuPSbCn2Pe8sNW3YV AR+EH4kzSUIf+kVd47Mo4KidKK+oMRHZZjEBm8kBeFZuGKmLAF7jGp8fFUuEXVGdoVmj OBbJv1HhrtBWChZ9pTP/oqry/cLDE2Ap+n13qb3RqRfH94ZaF4JhK/71/L7z1VV062H4 eEjXqjVDT5i4eo0VctVAmqlOLbNMi9axKUym+RZTuFix+uGzA1vGTvb81ddj1pO9Byzb o/Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vMfrOzEq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x28si6042866edd.427.2019.10.31.23.16.20; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vMfrOzEq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729716AbfKAGQS (ORCPT + 26 others); Fri, 1 Nov 2019 02:16:18 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:46078 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728895AbfKAGQP (ORCPT ); Fri, 1 Nov 2019 02:16:15 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id xA16ELBf016348; Fri, 1 Nov 2019 15:14:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xA16ELBf016348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572588867; bh=EbWxLFiY8h504jFBt4i5+hTSLW7vcJ0MI7MXhe5UQ4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMfrOzEqcV2/ffzg63CsgD7KAK9Gc0e7hcDmgQ5MXqttKHTYPbVhJUrLSB9juAYul wLYUcgfYY9xp/QA/isOxstI60AFkA7nkGfwgpkyWCxb+RNjh4NtViZ3ZnVA+FsP2zZ L9jNI7XCSZD9bd/Ek/CRT1iwSb7U3g77mbixfMq0Ed+bMCGVnijS76NCTdCzg3YIG0 vV+neEM0QKtdfOAOOUCuPZ7fXARQVLN4w5dVIGJHHNVB2nrfIlA5cmTURunQ/FfsPA MU8oOsILf/rtcXXFSPg7fpTmc+VqTztF8Ms7vjSiXjN5X0OxSchINuevpDufACdFd2 e9kOSSAmqnYOw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Cc: linux-arm-kernel@lists.infradead.org, David Gibson , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Fri, 1 Nov 2019 15:14:11 +0900 Message-Id: <20191101061411.16988-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101061411.16988-1-yamada.masahiro@socionext.com> References: <20191101061411.16988-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The libfdt in the upstream DTC project added references to (U)INT32_MAX by the following commits: Commit 812b1956a076 ("libfdt: Tweak data handling to satisfy Coverity") Commit 7fcf8208b8a9 ("libfdt: add fdt_append_addrrange()") The kernel needs to adjust libfdt_env.h before pulling in the changes. As for the user-space programs, defines (U)INT32_MAX along with (u)int32_t. In the kernel, on the other hand, we usually use s32 / u32 instead of (u)int32_t for the fixed-width types. Accordingly, we already have S32_MAX / U32_MAX for their max values. So, we won't add (U)INT32_MAX to any more. Instead, add them to the in-kernel libfdt_env.h to compile fdt.c and fdt_addresses.c Signed-off-by: Masahiro Yamada --- arch/powerpc/boot/libfdt_env.h | 2 ++ include/linux/libfdt_env.h | 3 +++ 2 files changed, 5 insertions(+) -- 2.17.1 diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index 2abc8e83b95e..a4a386114ef5 100644 --- a/arch/powerpc/boot/libfdt_env.h +++ b/arch/powerpc/boot/libfdt_env.h @@ -6,6 +6,8 @@ #include #define INT_MAX ((int)(~0U>>1)) +#define INT32_MAX ((u32)~0U) +#define UINT32_MAX ((s32)(INT_MAX >> 1)) #include "of.h" diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h index edb0f0c30904..0bd83bdb2482 100644 --- a/include/linux/libfdt_env.h +++ b/include/linux/libfdt_env.h @@ -11,6 +11,9 @@ typedef __be16 fdt16_t; typedef __be32 fdt32_t; typedef __be64 fdt64_t; +#define INT32_MAX S32_MAX +#define UINT32_MAX U32_MAX + #define fdt32_to_cpu(x) be32_to_cpu(x) #define cpu_to_fdt32(x) cpu_to_be32(x) #define fdt64_to_cpu(x) be64_to_cpu(x)