Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3506324rwb; Tue, 8 Nov 2022 05:27:48 -0800 (PST) X-Google-Smtp-Source: AMsMyM5x4EFDy9n0V45PEhgsBScYqSWSfiHFu2vrDS9V3XLskssSkraCUDmK+/zvR+Tp4Gk22obQ X-Received: by 2002:a17:907:75d0:b0:7ad:8a7a:1a53 with SMTP id jl16-20020a17090775d000b007ad8a7a1a53mr52324493ejc.47.1667914067814; Tue, 08 Nov 2022 05:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667914067; cv=none; d=google.com; s=arc-20160816; b=F3SsnSovGZehHq4pI0GYr6j00I6JaNry8PH3rp81BVJH9CanIUwPQkWEfyTPjZvu+w E88xT+FJNCDjWFQOBataEJMgzyV8eXLf20DFzja2QArn9tDTg0brq/7ZbFhtlk6YIz+y 1HD48FM4qyAmxT6iipW5yT1bssDmNvLR4WVhrRZED8ObAz0n2OMxW0PkQFLPU/zMKwQr eRBbuhwDPSFUND3FiZTkAEJMqETk28pQMo/us2b6HscKwJrIWbbTtwOwxcJcLVYzmmy8 W1hXMLbOcMn9uZ/lohj1gneBr9F+o2omYgITt3hpaP14pupHtxCIP4g1aaSbuMGoBXUM i0fw== 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 :message-id:date:subject:cc:to:from; bh=7FO0tzIx0QGsfHDy0xBo5ZCI9fvwp81vpHE38PQsmA8=; b=YzhvtfN3mYpfOHtX+dAAlbW6EpZl70iMjXS60s3TNRa6oTCrgnZ3MNFgiv+epN3s/o fo6MdmbGqmuPqeFprkj6nAXl2NeplTD1R4nXexmqRqFhohFfveJSc8XiPsQZHSDX/JgB b9YofXgaKgNny4yaE0j0yLH7SmdXNjlYz/ow5vH1Fk/Llz68nDcu+GNJWMhRd9M4eNP8 jHNMXGGFE87r+1H6VFMx6SSqcgou8nK4f1SZZS0m2cmArWJ9YfX35taQVxMJugXvhOUR HMGcAmE3Fz/ha59BIu0Ok27Jj5hf9/wkw4cxLUpiJGUlK29aINFLY+z5OS3avox5Y0mK N4QA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a056402170300b004615ccd71a0si12144891edu.162.2022.11.08.05.27.26; Tue, 08 Nov 2022 05:27:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234123AbiKHMTj (ORCPT + 89 others); Tue, 8 Nov 2022 07:19:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233722AbiKHMTe (ORCPT ); Tue, 8 Nov 2022 07:19:34 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE532339E; Tue, 8 Nov 2022 04:19:32 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4N66bd5nRmz4f3w16; Tue, 8 Nov 2022 20:19:25 +0800 (CST) Received: from localhost.localdomain (unknown [10.67.175.61]) by APP4 (Coremail) with SMTP id gCh0CgCH+dZQSWpjw668AA--.47234S2; Tue, 08 Nov 2022 20:19:28 +0800 (CST) From: Pu Lehui To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Eduard Zingerman , Pu Lehui , Pu Lehui Subject: [PATCH bpf] selftests/bpf: Fix casting error when cross-compiling test_verifier for 32-bit platforms Date: Tue, 8 Nov 2022 20:19:45 +0800 Message-Id: <20221108121945.4104644-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCH+dZQSWpjw668AA--.47234S2 X-Coremail-Antispam: 1UD129KBjvJXoW7CFykKF1UKw48KFyDCry5XFb_yoW8GryUpF WrG3sFgFy8X3W3Kr1UAF4UtrW8KF1qqa48Gry3tryDZF4DKF92gFyxKrWqvr93uFWrXwna y347Was8Xw1qyrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Y14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCY1x0262kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6Fyj6rWU JwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCT nIWIevJa73UjIFyTuYvjfUr2-eDUUUU X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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-kernel@vger.kernel.org From: Pu Lehui When cross-compiling test_verifier for 32-bit platforms, the casting error is shown below: test_verifier.c:1263:27: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 1263 | info.xlated_prog_insns = (__u64)*buf; | ^ cc1: all warnings being treated as errors Fix it by adding zero-extension for it. Fixes: 933ff53191eb ("selftests/bpf: specify expected instructions in test_verifier tests") Signed-off-by: Pu Lehui --- tools/testing/selftests/bpf/test_verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 2dbcbf363c18..b605a70d4f6b 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -1260,7 +1260,7 @@ static int get_xlated_program(int fd_prog, struct bpf_insn **buf, int *cnt) bzero(&info, sizeof(info)); info.xlated_prog_len = xlated_prog_len; - info.xlated_prog_insns = (__u64)*buf; + info.xlated_prog_insns = (__u64)(unsigned long)*buf; if (bpf_obj_get_info_by_fd(fd_prog, &info, &info_len)) { perror("second bpf_obj_get_info_by_fd failed"); goto out_free_buf; -- 2.25.1