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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3231C47E49 for ; Fri, 1 Nov 2019 08:13:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 866EB208E3 for ; Fri, 1 Nov 2019 08:13:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="24wqhJT7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730296AbfKAINx (ORCPT ); Fri, 1 Nov 2019 04:13:53 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:32221 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730157AbfKAINx (ORCPT ); Fri, 1 Nov 2019 04:13:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id xA18BsBQ023869; Fri, 1 Nov 2019 17:11:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xA18BsBQ023869 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572595923; bh=dMOvEpUrv3gUpGiwcs/+Eb8AZVQbVFB1v4ogmdr2bko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=24wqhJT7RJMf50vgPNVtuOw7sfdCTIBCGMN1/+85H2fjdBWjCBMgKq4Gi/Zo8KO2Y VlgD461HyHetk8JzsJ7Ekalb9WtIQBjoIaG78+XXVkIjX89OQ/6jth0bvnMY7mY/Zy kZ1FsZLs884Twsxjffd5wE/JArN05kQGyzXNHNkQnzTcfwsuqyMuM02JwDm5mdrvDY 5imCL2rnn/7JQ+QTDtFB+kbwLTgcoxcrAjnIIPElUvBT0solhQTWvr+EhskjVm4OS1 vqipju34mMQPwLWkDveV8HSaTxr8C3ugI1gbtT2+b+racWCIlXeZnHt+T/q7S8T8kL VV3/6jEArBPKQ== 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 v2 3/3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Fri, 1 Nov 2019 17:11:48 +0900 Message-Id: <20191101081148.23274-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101081148.23274-1-yamada.masahiro@socionext.com> References: <20191101081148.23274-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 --- Changes in v2: - Fix ppc libfdt_env.h arch/powerpc/boot/libfdt_env.h | 2 ++ include/linux/libfdt_env.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index 2abc8e83b95e..9757d4f6331e 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 UINT32_MAX ((u32)~0U) +#define INT32_MAX ((s32)(UINT32_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) -- 2.17.1 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 X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23951C47E49 for ; Fri, 1 Nov 2019 08:17:51 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2CBE208CB for ; Fri, 1 Nov 2019 08:17:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="24wqhJT7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2CBE208CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 474FRw3PHHzF5qw for ; Fri, 1 Nov 2019 19:17:48 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=socionext.com (client-ip=210.131.2.79; helo=conuserg-12.nifty.com; envelope-from=yamada.masahiro@socionext.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="24wqhJT7"; dkim-atps=neutral Received: from conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 474FLm5NtNzF6SG for ; Fri, 1 Nov 2019 19:13:19 +1100 (AEDT) Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id xA18BsBQ023869; Fri, 1 Nov 2019 17:11:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xA18BsBQ023869 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572595923; bh=dMOvEpUrv3gUpGiwcs/+Eb8AZVQbVFB1v4ogmdr2bko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=24wqhJT7RJMf50vgPNVtuOw7sfdCTIBCGMN1/+85H2fjdBWjCBMgKq4Gi/Zo8KO2Y VlgD461HyHetk8JzsJ7Ekalb9WtIQBjoIaG78+XXVkIjX89OQ/6jth0bvnMY7mY/Zy kZ1FsZLs884Twsxjffd5wE/JArN05kQGyzXNHNkQnzTcfwsuqyMuM02JwDm5mdrvDY 5imCL2rnn/7JQ+QTDtFB+kbwLTgcoxcrAjnIIPElUvBT0solhQTWvr+EhskjVm4OS1 vqipju34mMQPwLWkDveV8HSaTxr8C3ugI1gbtT2+b+racWCIlXeZnHt+T/q7S8T8kL VV3/6jEArBPKQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Subject: [PATCH v2 3/3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Fri, 1 Nov 2019 17:11:48 +0900 Message-Id: <20191101081148.23274-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101081148.23274-1-yamada.masahiro@socionext.com> References: <20191101081148.23274-1-yamada.masahiro@socionext.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, David Gibson Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- Changes in v2: - Fix ppc libfdt_env.h arch/powerpc/boot/libfdt_env.h | 2 ++ include/linux/libfdt_env.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index 2abc8e83b95e..9757d4f6331e 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 UINT32_MAX ((u32)~0U) +#define INT32_MAX ((s32)(UINT32_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) -- 2.17.1 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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7033CA9EC9 for ; Fri, 1 Nov 2019 08:12:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85AA1208E3 for ; Fri, 1 Nov 2019 08:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e863sYxY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="24wqhJT7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85AA1208E3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4CDg0VrIScFJbA3+XTV2wprokFC2WFtFLAa2rjEZXYM=; b=e863sYxYyoxsCdrQ+6RIlyLib7 0LYnwZwhK1MEb2DQl7VfLWi/rDRVdcGoMjVe0Yyx2Br7H1NaIv5bs76GzsNDoh6NB3Vj12p0wCI4S HYJSlTmgUwlLSuo1Jsb0Id12vv2+OIQeLincqWFCikxf9/fmFWmRsBJiklEFxwJPMcOhrXYem1skC LJAiz000N+bFwQXimr7obiTnUUU66fD8gw38Rc3YMwWGk6NW51TcSdbInduiTNs4PEXsMr9Qg673/ IW2FlwK/G49xfKeqVB37MbLhJPpGwb/2g3mskUooYVbx95t6PKZH+2SPJDakjxxNbnk86VLv/enzG 8EhCxmRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQS2y-0003cx-6y; Fri, 01 Nov 2019 08:12:40 +0000 Received: from conuserg-12.nifty.com ([210.131.2.79]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQS2v-0003bS-AN for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 08:12:38 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id xA18BsBQ023869; Fri, 1 Nov 2019 17:11:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xA18BsBQ023869 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572595923; bh=dMOvEpUrv3gUpGiwcs/+Eb8AZVQbVFB1v4ogmdr2bko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=24wqhJT7RJMf50vgPNVtuOw7sfdCTIBCGMN1/+85H2fjdBWjCBMgKq4Gi/Zo8KO2Y VlgD461HyHetk8JzsJ7Ekalb9WtIQBjoIaG78+XXVkIjX89OQ/6jth0bvnMY7mY/Zy kZ1FsZLs884Twsxjffd5wE/JArN05kQGyzXNHNkQnzTcfwsuqyMuM02JwDm5mdrvDY 5imCL2rnn/7JQ+QTDtFB+kbwLTgcoxcrAjnIIPElUvBT0solhQTWvr+EhskjVm4OS1 vqipju34mMQPwLWkDveV8HSaTxr8C3ugI1gbtT2+b+racWCIlXeZnHt+T/q7S8T8kL VV3/6jEArBPKQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Subject: [PATCH v2 3/3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Fri, 1 Nov 2019 17:11:48 +0900 Message-Id: <20191101081148.23274-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101081148.23274-1-yamada.masahiro@socionext.com> References: <20191101081148.23274-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_011237_594446_33556E9E X-CRM114-Status: UNSURE ( 8.26 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Herrenschmidt , linux-kernel@vger.kernel.org, Masahiro Yamada , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, David Gibson MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- Changes in v2: - Fix ppc libfdt_env.h arch/powerpc/boot/libfdt_env.h | 2 ++ include/linux/libfdt_env.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index 2abc8e83b95e..9757d4f6331e 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 UINT32_MAX ((u32)~0U) +#define INT32_MAX ((s32)(UINT32_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) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel