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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8571FECAAD4 for ; Sun, 4 Sep 2022 10:36:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233865AbiIDKg6 (ORCPT ); Sun, 4 Sep 2022 06:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbiIDKgw (ORCPT ); Sun, 4 Sep 2022 06:36:52 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB2D1A075; Sun, 4 Sep 2022 03:36:50 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id t7so2773557wrm.10; Sun, 04 Sep 2022 03:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=nm3l/5tmVYSxCPHkufqRYaNkN+NHrBZPKsqsiOzgYMw=; b=d6E95ITP96aHNOZfgRwe9C8jQAY6whrpnLChU+l6AncOxrOKbrFeBz9AXkKp2GSpaz PonplmjU5dTsqLmz2BLQftVawRqyTWUYXGW6boj/pyH2HdJb0B8fxffmIXxPMEUURECx Io0PODKEPVqTYVcHEMBqe0snbv1myJt5zDPLTzgawoiH/qTHspOAG17S+TROSZ9aloDI Qaxf22gyuU+ZC3sVDEkDurJvrGy9i3QADEmGrnP1NYwqk8c73wIh4UMuRKdwTXc241GP /U4evSAojN1WtfwveoJq7O8tjXUnki1Wvku/b0BafB9cmjidMQH6fZO69JJURJ1ROAu9 U4CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=nm3l/5tmVYSxCPHkufqRYaNkN+NHrBZPKsqsiOzgYMw=; b=zMPdgYkGpOyUSBtJxbddmiuSSIMwSGrHh+/R/rho2m1CdPEEEzlUnmP1Q9wvjoldxK Bw6OmmcVLRKkSBRd80SUD7SwsH5DvdkSydlm42Bnub8QkUVYGjDj9deJGelgP87xjFFJ aawKsQvo6BxsYXzhdDrA287cnEBBpdk3JQxB2Z18JiNNKxNDh6gib6js3tCPTUDaIfBn RaGbKHV1cNvoyUKsJFp8/HPafHh9YJPnaBxd/G170YBkl8oy7psW0blPwvNRhffftGF7 8uOtYi4WJLAvGkbORWyStLAXrxnXdLL6Ft89EsGmc3oOAyXu8i4bMUlNjK9yWdaCNK8p gWww== X-Gm-Message-State: ACgBeo28X79JDgKhjCEFZTeFWZaOXKukY8o53JDO9k7zDO9rcj23GMxM IcnfWYXztcQHKBKXpcNMZ5b/MlAErYVR X-Google-Smtp-Source: AA6agR6EEw6CQAwdooKIp5jMRAmmswV09j0COAv/iGqoHRphCDVeI2/KBfTqrShvBXQJkdmsKW0acg== X-Received: by 2002:a5d:684e:0:b0:220:63df:3760 with SMTP id o14-20020a5d684e000000b0022063df3760mr20572296wrw.508.1662287809289; Sun, 04 Sep 2022 03:36:49 -0700 (PDT) Received: from playground (host-92-29-143-165.as13285.net. [92.29.143.165]) by smtp.gmail.com with ESMTPSA id p17-20020a5d4e11000000b00225250f2d1bsm5718150wrt.94.2022.09.04.03.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Sep 2022 03:36:49 -0700 (PDT) Date: Sun, 4 Sep 2022 11:36:41 +0100 From: Jules Irenge To: Kumar Kartikeya Dwivedi Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, john.fastabend@gmail.com, ast@kernel.org Subject: Re: [PATCH 1/2] bpf: Fix warning of Using plain integer as NULL pointer Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 03, 2022 at 09:10:31PM +0200, Kumar Kartikeya Dwivedi wrote: > On Sat, 3 Sept 2022 at 20:59, Jules Irenge wrote: > > > > This patch fixes a warning generated by Sparse > > > > "Using plain integer as NULL pointer" > > > > by replacing the offending 0 by NULL. > > > > Signed-off-by: Jules Irenge > > --- > > kernel/bpf/syscall.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > > index 27760627370d..427b7e3829e0 100644 > > --- a/kernel/bpf/syscall.c > > +++ b/kernel/bpf/syscall.c > > @@ -598,7 +598,7 @@ void bpf_map_free_kptrs(struct bpf_map *map, void *map_value) > > if (off_desc->type == BPF_KPTR_UNREF) { > > u64 *p = (u64 *)btf_id_ptr; > > > > - WRITE_ONCE(p, 0); > > + WRITE_ONCE(p, NULL); > > Uff, this should have been WRITE_ONCE(*p, 0) instead. Mea Culpa. > Can you make that fix? It's not a big problem since it's just that the > pointer won't be cleared on map value delete (and there is nothing to > reclaim for the unref case when map is freed), so you can target > bpf-next with a Fixes tag. > So in your patch you will need [PATCH bpf-next] in the subject and the > fixes tag would be: > Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr") Thanks, already done. if there is anything I miss, please let me know. I am on a learning journey. Jules