Message ID | 20221221-bpf-syscall-v1-0-9550f5f2c3fc@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3714969wrn; Wed, 21 Dec 2022 11:58:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKopKWg/sMHo/S4/qv11hkcWuN2rYNrjqWdjyXhlwnxKgR1MJ5rsU9cv6b3DYslmbftIC3 X-Received: by 2002:a17:907:a809:b0:7c1:5467:39af with SMTP id vo9-20020a170907a80900b007c1546739afmr2855590ejc.37.1671652690287; Wed, 21 Dec 2022 11:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671652690; cv=none; d=google.com; s=arc-20160816; b=ri5uAnttcbFildOo827/bJkHqw10I/yTaSDzaElU5+LFLM0FHteUgGxXzabk/V4OcB jamUV69jF9PbYADZuRhnzlgm+ffLZKxc3tIBwLs015j+IJLEpaJw0GpS6ciBRIoKNQCq dOrOeRsgoPvldXe6n8x4uj5BPCK9ZOtaUfdwj8OgAXq6nlMCp0lPUwy72AvE3fFxuXdo mXqUB3Q/KD4wd+4WHoz3gXf78+kmVFwjvVomKUNMc/VzqsTsSKBsYOkEyjB+42Ga+sfA WvPP+6s23WLri4cAQWI04Q5bVgozkvpHgHo7L48B7+mL/KaBR11w+/M3jsLOs1/LABnK +bfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=EDpY8eXQnR31vDv/hAEogmXTX86hvb4cFMl7BLiqYmU=; b=pfjhQBUREkZiWrr9A+WhYiVNcIVyKaKInVgkZZE38Go6zjnrzp6rtHTfupFk9hz3b4 1+S4EfFwrGdbjbPRGACTO+2HYngYmp+inEGqql1R8Ah2fzon+b58ak5WnlSy3u9GiBFZ z56Qnz+4HMvS8Fmzmj0Jj9ZgOBCI3uqyd3sUReSZS+dGuCpvig7XEtjXJAIRzDP19qsL hVeWhN7QBvlEivGVZeXM1aW9T1y+B5k9n5onO4oSVHeEAQtGVDLuJ5CJQlYJ7VyTBfnf bBAFqod5Fn3KRzxDrQUkl3/+oefyhzWRpe8NU+OdodB3RB8hw9FsMX6wq+BjgReH7pHX PBig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CdojP4kO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b007c171bf2316si2262180ejc.634.2022.12.21.11.57.46; Wed, 21 Dec 2022 11:58:10 -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; dkim=pass header.i=@chromium.org header.s=google header.b=CdojP4kO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234553AbiLUTzl (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Wed, 21 Dec 2022 14:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbiLUTzj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 21 Dec 2022 14:55:39 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E28226AC0 for <linux-kernel@vger.kernel.org>; Wed, 21 Dec 2022 11:55:37 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id a1so39044edf.5 for <linux-kernel@vger.kernel.org>; Wed, 21 Dec 2022 11:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=EDpY8eXQnR31vDv/hAEogmXTX86hvb4cFMl7BLiqYmU=; b=CdojP4kOwKnkm/3tJ0fwwgiSGm2ckaeouWf4meonSAZrsGDHoQIDukZhPd4hibbAeo DX8YE2PInUDbz8/HiRNou464YkTmN/upcjWmK0cwnnxP983cv4wBxY8LfEHOM7j91rC6 in8oT77Q8VmARZ5yd+wCCP9ZQvJhlyqr0Msdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EDpY8eXQnR31vDv/hAEogmXTX86hvb4cFMl7BLiqYmU=; b=b/yzzt1IGtnnIcZOtEz1zgZltWS5hdbtbmWj61rWjojN9EEhZi6CzahcxY+ld2i0Ww brWHKHX0wS7ZYFpW2OtfsTcTl9CseBp5mHT9EV9CycrFzo+ehebVeb4rDwvNHpLDG+aK PP0m017x3u3bzUT56Pc5z51Ow+M2jpWELwaYfK7rcVaEKb9l7V4s8b6E4w+AfkQa45NT WypGQFmEn3GL8/2iTTBXYdXrvHk3WDCpBH3hRrKeUneLAjG4bUP2lUYzsaktpDDJPD2v Yaz444HCD3PUxyNrO7HLdTTyZUZi8TkYLwIVyCvwr+QTGVuG4OPD8nYbjx9y/JkJdA+8 U0zQ== X-Gm-Message-State: AFqh2kr7GL8C+rzikkWaiwxWzlhcXz1zlNZrqrXxYcIbEsSesN6OfFig zMq2oMYYm/R+HndTSTZmc48APQ== X-Received: by 2002:a05:6402:558:b0:47e:5b70:de7b with SMTP id i24-20020a056402055800b0047e5b70de7bmr1961383edx.19.1671652535931; Wed, 21 Dec 2022 11:55:35 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id q22-20020a17090676d600b0080c433a9eeesm5586005ejn.182.2022.12.21.11.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 11:55:35 -0800 (PST) From: Ricardo Ribalda <ribalda@chromium.org> Date: Wed, 21 Dec 2022 20:55:29 +0100 Subject: [PATCH] bpf: Remove unused field initialization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20221221-bpf-syscall-v1-0-9550f5f2c3fc@chromium.org> To: John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Jiri Olsa <jolsa@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, Daniel Borkmann <daniel@iogearbox.net>, Hao Luo <haoluo@google.com>, Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andrii@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Song Liu <song@kernel.org>, Stanislav Fomichev <sdf@google.com> Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda <ribalda@chromium.org> X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=1511; i=ribalda@chromium.org; h=from:subject:message-id; bh=oJ2oob+OSIF7kWeCn8kKWNN2TjOq3zxbD7ZuB1oIGg8=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjo2Sz0BzcDBqxuAFxDAOjbqq++6jm3aPwxe7NWrxe 4+2PVLiJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY6NkswAKCRDRN9E+zzrEiOI2D/ 9AzaS8R53TwYp+QQybEExGc3dyoRGwGB4fBDXlti82+f7dTgL4K8OKqpu27Hmp6YEamzToSvtLUKt+ Xf5DGm0ejHzPRyee3gq7KX4ZSKSZUacHBuBidhpuxYBwA/k1/SSYt0AVIzyKBD3l7eHN6rR1561yMr 6Jfbo+WuFww2tksLHN6CnI1thn2xGGUYdo6XzdjTuG7F1BDP9sGDdsVdZQwTGZZpYWgoO9lOpwgq3d FWFYmZf9hNMuuTLk9CbpUUsf+1zaS4qzaCUwL9/0ak5YhZPyquE2xIqLUIWk99vzCcDmLyed5BKSd2 xFMXjsjPyk1SDZgYIvkeznWa1SKGkAPPy9i8IyFSKVj4A2tO2wKLPdqfEHg5yhf8xuuTcSh3VIknnV PLGCB1oCQMPUJH8SzxRxhJ8OS+F+ZXc2zEmdRj+BIofYQs0kk/WccH59zj3JA2wmlaFPg+H8a+tImX 1tvBc4I+WPb74PAbUJj/5CQjltv+iJk9GzHXIE7UH/vzoj7loGEHIdsY2cmuoPaAh9fBHyN24fCo+a LnjWut+09mykw2hRk02dDj/hXChQImXxZbTVhtoprhdNOy4DpgREOJDGvlVfWfo8kmf54qSe4e3uON lwQouHwYJjhYuCeycqW11pXWW9gleXMNUNVTiFmtoO/EtU00Nvb8tpyZHzTA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752854891210646328?= X-GMAIL-MSGID: =?utf-8?q?1752854891210646328?= |
Series |
bpf: Remove unused field initialization
|
|
Commit Message
Ricardo Ribalda
Dec. 21, 2022, 7:55 p.m. UTC
Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
case we have our own proc_handler. Remove the initialization.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
bpf: Trivial remove of unitialised field.
I have inspired myself in your code and heritaded this bug :). Fixing this
here so none else makes the same mistake.
To: Alexei Starovoitov <ast@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
To: John Fastabend <john.fastabend@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>
To: Martin KaFai Lau <martin.lau@linux.dev>
To: Song Liu <song@kernel.org>
To: Yonghong Song <yhs@fb.com>
To: KP Singh <kpsingh@kernel.org>
To: Stanislav Fomichev <sdf@google.com>
To: Hao Luo <haoluo@google.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
kernel/bpf/syscall.c | 1 -
1 file changed, 1 deletion(-)
---
base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
change-id: 20221221-bpf-syscall-58d1ac3f817a
Best regards,
Comments
On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this > case we have our own proc_handler. Remove the initialization. Are you sure? bpf_stats_handler proc_dointvec_minmax do_proc_dointvec __do_proc_dointvec vleft = table->maxlen / sizeof(*i); Maybe we should really do the following instead? .maxlen: sizeof(int) ? > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > bpf: Trivial remove of unitialised field. > > I have inspired myself in your code and heritaded this bug :). Fixing this > here so none else makes the same mistake. > > To: Alexei Starovoitov <ast@kernel.org> > To: Daniel Borkmann <daniel@iogearbox.net> > To: John Fastabend <john.fastabend@gmail.com> > To: Andrii Nakryiko <andrii@kernel.org> > To: Martin KaFai Lau <martin.lau@linux.dev> > To: Song Liu <song@kernel.org> > To: Yonghong Song <yhs@fb.com> > To: KP Singh <kpsingh@kernel.org> > To: Stanislav Fomichev <sdf@google.com> > To: Hao Luo <haoluo@google.com> > To: Jiri Olsa <jolsa@kernel.org> > Cc: bpf@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > kernel/bpf/syscall.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 35972afb6850..8e55456bd648 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = { > { > .procname = "bpf_stats_enabled", > .data = &bpf_stats_enabled_key.key, > - .maxlen = sizeof(bpf_stats_enabled_key), > .mode = 0644, > .proc_handler = bpf_stats_handler, > }, > > --- > base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf > change-id: 20221221-bpf-syscall-58d1ac3f817a > > Best regards, > -- > Ricardo Ribalda <ribalda@chromium.org>
Hi Stanislav On Wed, 21 Dec 2022 at 21:10, Stanislav Fomichev <sdf@google.com> wrote: > > On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > > > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this > > case we have our own proc_handler. Remove the initialization. > > Are you sure? > > bpf_stats_handler > proc_dointvec_minmax > do_proc_dointvec > __do_proc_dointvec > vleft = table->maxlen / sizeof(*i); I believe do_proc_dointvec is using the value from: struct ctl_table tmp = { .maxlen=sixeof(val); } > > Maybe we should really do the following instead? > > .maxlen: sizeof(int) > > ? > > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > --- > > bpf: Trivial remove of unitialised field. > > > > I have inspired myself in your code and heritaded this bug :). Fixing this > > here so none else makes the same mistake. > > > > To: Alexei Starovoitov <ast@kernel.org> > > To: Daniel Borkmann <daniel@iogearbox.net> > > To: John Fastabend <john.fastabend@gmail.com> > > To: Andrii Nakryiko <andrii@kernel.org> > > To: Martin KaFai Lau <martin.lau@linux.dev> > > To: Song Liu <song@kernel.org> > > To: Yonghong Song <yhs@fb.com> > > To: KP Singh <kpsingh@kernel.org> > > To: Stanislav Fomichev <sdf@google.com> > > To: Hao Luo <haoluo@google.com> > > To: Jiri Olsa <jolsa@kernel.org> > > Cc: bpf@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > --- > > kernel/bpf/syscall.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > > index 35972afb6850..8e55456bd648 100644 > > --- a/kernel/bpf/syscall.c > > +++ b/kernel/bpf/syscall.c > > @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = { > > { > > .procname = "bpf_stats_enabled", > > .data = &bpf_stats_enabled_key.key, > > - .maxlen = sizeof(bpf_stats_enabled_key), > > .mode = 0644, > > .proc_handler = bpf_stats_handler, > > }, > > > > --- > > base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf > > change-id: 20221221-bpf-syscall-58d1ac3f817a > > > > Best regards, > > -- > > Ricardo Ribalda <ribalda@chromium.org>
On Wed, Dec 21, 2022 at 12:13 PM Ricardo Ribalda <ribalda@chromium.org> wrote: > > Hi Stanislav > > On Wed, 21 Dec 2022 at 21:10, Stanislav Fomichev <sdf@google.com> wrote: > > > > On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote: > > > > > > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this > > > case we have our own proc_handler. Remove the initialization. > > > > Are you sure? > > > > bpf_stats_handler > > proc_dointvec_minmax > > do_proc_dointvec > > __do_proc_dointvec > > vleft = table->maxlen / sizeof(*i); > > I believe do_proc_dointvec is using the value from: > > struct ctl_table tmp = { > .maxlen=sixeof(val); > } Oh, you're right, I've missed that! Acked-by: Stanislav Fomichev <sdf@google.com> > > > > Maybe we should really do the following instead? > > > > .maxlen: sizeof(int) > > > > ? > > > > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > > > --- > > > bpf: Trivial remove of unitialised field. > > > > > > I have inspired myself in your code and heritaded this bug :). Fixing this > > > here so none else makes the same mistake. > > > > > > To: Alexei Starovoitov <ast@kernel.org> > > > To: Daniel Borkmann <daniel@iogearbox.net> > > > To: John Fastabend <john.fastabend@gmail.com> > > > To: Andrii Nakryiko <andrii@kernel.org> > > > To: Martin KaFai Lau <martin.lau@linux.dev> > > > To: Song Liu <song@kernel.org> > > > To: Yonghong Song <yhs@fb.com> > > > To: KP Singh <kpsingh@kernel.org> > > > To: Stanislav Fomichev <sdf@google.com> > > > To: Hao Luo <haoluo@google.com> > > > To: Jiri Olsa <jolsa@kernel.org> > > > Cc: bpf@vger.kernel.org > > > Cc: linux-kernel@vger.kernel.org > > > --- > > > kernel/bpf/syscall.c | 1 - > > > 1 file changed, 1 deletion(-) > > > > > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > > > index 35972afb6850..8e55456bd648 100644 > > > --- a/kernel/bpf/syscall.c > > > +++ b/kernel/bpf/syscall.c > > > @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = { > > > { > > > .procname = "bpf_stats_enabled", > > > .data = &bpf_stats_enabled_key.key, > > > - .maxlen = sizeof(bpf_stats_enabled_key), > > > .mode = 0644, > > > .proc_handler = bpf_stats_handler, > > > }, > > > > > > --- > > > base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf > > > change-id: 20221221-bpf-syscall-58d1ac3f817a > > > > > > Best regards, > > > -- > > > Ricardo Ribalda <ribalda@chromium.org> > > > > -- > Ricardo Ribalda
Hello: This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <daniel@iogearbox.net>: On Wed, 21 Dec 2022 20:55:29 +0100 you wrote: > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this > case we have our own proc_handler. Remove the initialization. > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > bpf: Trivial remove of unitialised field. > > [...] Here is the summary with links: - bpf: Remove unused field initialization https://git.kernel.org/bpf/bpf-next/c/cfca00767feb You are awesome, thank you!
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 35972afb6850..8e55456bd648 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = { { .procname = "bpf_stats_enabled", .data = &bpf_stats_enabled_key.key, - .maxlen = sizeof(bpf_stats_enabled_key), .mode = 0644, .proc_handler = bpf_stats_handler, },