From patchwork Wed Jul 21 21:19:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 483345 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6570189jao; Wed, 21 Jul 2021 14:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuINoyAebngINGF47z6HdWWW++heOPKu8DM6ZEKmFWpDpx3JIbr6FaGVe4oSVJaizuGITO X-Received: by 2002:a05:6e02:1905:: with SMTP id w5mr11990188ilu.270.1626902416422; Wed, 21 Jul 2021 14:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626902416; cv=none; d=google.com; s=arc-20160816; b=KfAgPhq+x4tS4KIMbNl52bzLBtWZE/aCxX4ykN8UH8OGITmkXfiKLVgldn59rPTIZ6 ZtYLGanEblprnq3/aaIKg3Gc79OFpbz5pFYjdtPEzgEjQynDhwJt+R/KBgg4s45AyRfw U/MQlB/xZjNp35wMXW1ba/mEPM/CN3EGG7gIL4ZexE6XUYpvhY/25tKGovrJbuNglea8 PYbjLZ1Lg1sP5lvYUZzmGk/SCGFRmOGIRWwbuHmfXlXRrEi+VZmaMzCDkY5aEAvXAARs PXG4s/Ktbwhm63B27uaALWll0NvMEBfA0oSZObHmLVgJE5l0iox2sjtUiQbK/blqobcd 9AFw== 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:dkim-signature; bh=7Rxigx+LRMSo4l6bFuwzugHQ6exnKmdH+OM3lwQkOUI=; b=oUnMnb4qEek8yMtlyY3IzS8b6izCrfppxRbBbQQxbDhl9s9BGRcXW0Py/lwMs8jz24 RkImhvfBW4JOrFBvjNHwme6rQpkP1hkRm35vj7fLkNRZP6rNYRH3OPnk3/gq2dQ/jyft wvq/9CEiaexaZvz24Q3pnOSSoKC0HJxlGG2gYCR+2h3VEYgTl+xsAqetpfaMzANEMl8N alxsf/H9NlihxHZRYB3edE3AqI1adbDkoSelm/8tFGduD8bLutuCA0emuM1+0RJok/Di OwIMwDYU6EY7ulTPIcjWsUePUlTj6ZVpe0d3Ail/WBpcFfvdJgT/vnBhGPTkqNDf0IPE p12g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LWKs+DgV; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si4570840ion.36.2021.07.21.14.20.16; Wed, 21 Jul 2021 14:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LWKs+DgV; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S229604AbhGUUjh (ORCPT + 8 others); Wed, 21 Jul 2021 16:39:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:39240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhGUUjg (ORCPT ); Wed, 21 Jul 2021 16:39:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 86E8D61001; Wed, 21 Jul 2021 21:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626902412; bh=nY7Q2Gu53XreSpv2eK6K9Pj/0kb0Rlq6C4OieN5DwQk=; h=From:To:Cc:Subject:Date:From; b=LWKs+DgVJAeoupL65lsFCr9W/4KeKzZM6w1XYmJEJy3Yv2Z9MYKWFYKKMCvwHLwAf 37BiKFx71vtqGrKyvLRnX8unHnCHtrP2GesNagye3UcWw9b+vMvjw7z2X8Rq6hUge8 O+WW0wFYs1+5lmqhA1VTDce+kROdetBaEehU/o7wIYwKLYuBIKttU5X6h0+vu9xBiM knP3x2Y848olxZ6USAXysygTeU5ygRwcK0QqQbCohpH17cu+mu7EhEr+Xw05PM2+oX tWGSWEWXQRmAR4Kuto+GUgdYZee9MG+cXV7N0ELH0ebHseWQEXa01mvPGNWWfq7x6k yHAcczawcZKFw== From: Arnd Bergmann To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Jiri Olsa Cc: Arnd Bergmann , Steven Rostedt , Ingo Molnar , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Florent Revest , Alan Maguire , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] bpf: fix pointer cast warning Date: Wed, 21 Jul 2021 23:19:45 +0200 Message-Id: <20210721212007.3876595-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann kp->addr is a pointer, so it cannot be cast directly to a 'u64' when it gets interpreted as an integer value: kernel/trace/bpf_trace.c: In function '____bpf_get_func_ip_kprobe': kernel/trace/bpf_trace.c:968:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 968 | return kp ? (u64) kp->addr : 0; Use the uintptr_t type instead. Fixes: 9ffd9f3ff719 ("bpf: Add bpf_get_func_ip helper for kprobe programs") Signed-off-by: Arnd Bergmann --- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.29.2 diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0de09f068697..a428d1ef0085 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -965,7 +965,7 @@ BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) { struct kprobe *kp = kprobe_running(); - return kp ? (u64) kp->addr : 0; + return kp ? (uintptr_t)kp->addr : 0; } static const struct bpf_func_proto bpf_get_func_ip_proto_kprobe = {