Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3706163imu; Mon, 28 Jan 2019 09:21:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MTyvZV9wTKOsh/5p2x3lnT04ewQ7rGXWk6LfJKBM1y1Bp1u+JmnhX/jTsa9kKF0dmeJMn X-Received: by 2002:a17:902:9691:: with SMTP id n17mr23221102plp.9.1548696080980; Mon, 28 Jan 2019 09:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696080; cv=none; d=google.com; s=arc-20160816; b=YOZy9ir8SR84feLpB2twIyNb6BUsiwH+MqWjSvEpdz90UvblSjIVw8YfPhWUqtBZ0I Y0n3KG+PGYuS/OqmBobABwzrQA+g6CoV0pZ9t+HjcRdYqkJUpo2LocYh6PKayF6CMst+ 10rkopk6BiDl61oo4oW36eLJQQbqV5hZ0Xrc8IpEiP/DGHHoVJD+kE/3NQW2WM03rXff yOQpwOyEes2W7TTdDXJmyD+EhaOGzkWrB5jfCRVvkgAQ55O1C9u73mE3FOSB62EJgjbf MEng9iO3Y3IfO/bVfv5e6lgnMUTDMI0XcNIF565GB9rd49XnOQ+L/AHCKJJr27FYM5T6 Y9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZREMQe/Zxzwcr4L0rEx84MvD8WUiexrrbKJ1DrVsjNw=; b=Csdq9zJwmVdmCT18lOCCNUlGz8pyJNjIQWIaLgZ0jsCqydwXTYD54coInVWm1Z+tes F0DZd3JSab1rjzY1883K0m4oKnIYQIIABVL2WWfnBMCGgiS7JWB4rs2UEwxiFLTobUu2 9FqbF32/WDuFMIsY/wofhuZih69gktGpleHqqpiZNpxSyWhi85n1T2XlABUnsjDY2cno HMPzONaSO6A8opvxiTzJ/JWbLeKtsJ2ftV/W7RqZM4ZAJx9Nl+YMX/obmR7BM1IrMI1N 0ec2spCjvelCcI2PygLh5a9njMoT94axMJl94y0p+XuQvO86uLf88wedEdaHz1h2i/SI BqZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JCl2w8wK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si23787712plc.277.2019.01.28.09.21.04; Mon, 28 Jan 2019 09:21:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JCl2w8wK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732127AbfA1RTE (ORCPT + 99 others); Mon, 28 Jan 2019 12:19:04 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:45642 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730204AbfA1RS5 (ORCPT ); Mon, 28 Jan 2019 12:18:57 -0500 Received: by mail-qk1-f193.google.com with SMTP id y78so9806584qka.12; Mon, 28 Jan 2019 09:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZREMQe/Zxzwcr4L0rEx84MvD8WUiexrrbKJ1DrVsjNw=; b=JCl2w8wKODSnxWDejcxItNxb+tIU0k1Mp5ww6FKLX+xRK86/McUhoW0U2TvFAds+Gq NkisHzWHEN+qazqYr9Qnz0pUhzoOoe3YwO8BaEdVmMOFNBjVAWqPlkw1ejKbzXJmQyOx yXytRALS7o1XFxdxCAZfPqF7ZAyCCAk/H7EM/RYjDUdf223rxKdWAafZ/+jCG1DsR48I O8b+NU2QwWsZbas/4OqVyZcGOkbfr0QBFTGGHwQgXxPt1dr3XKSX0FFejFG0OqNCV7cH +7Ibn3wP7H8r4SZ0Q26Cs3G1tmui9q3RCt7mCKbCxRncnmAUEB/DG1q+oIdH+AIth+4z adDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZREMQe/Zxzwcr4L0rEx84MvD8WUiexrrbKJ1DrVsjNw=; b=SA4tD/afIl7Q1aZTCQxDfhWyBUzxEc8iJFcEiiW42QmIO10zrPu3PpeYvot152WO16 LY9KRPi87DB7LMNQkDoO7jHUoFUg8oL88sobh2UNSoflvq//YcRmHyqwwryvM02NnPWJ 7QaxExqvpo553IcHpAULJM53hWP61DGBAZSD2uCuNuw5N9QAG5px7E0wFheKL32v8zS+ +6SaqgMjUKa7B0a4tmL18mQjaKuQwibEXCKeU1WptGiK5Yp+p14AmJ5vNU5JUP0lcR4v tjlp/BMAapsDZGkmIeQKZeFi425KnrqzSfDiHCMMXvbHmj1pf9Yy2uz4EiWYQerfAsHL rvQw== X-Gm-Message-State: AJcUukc6uJW0OaAKTyIpxwBa0Aosjyfx4a5Xrd8nWrufsLqnJ/+Pc91v D13GuGLp/tJEmEbkZ0mQlW3tgYQHOTnQilHEI2g= X-Received: by 2002:a37:cc4c:: with SMTP id r73mr19930545qki.120.1548695936320; Mon, 28 Jan 2019 09:18:56 -0800 (PST) MIME-Version: 1.0 References: <31468.1548648675@turing-police.cc.vt.edu> In-Reply-To: <31468.1548648675@turing-police.cc.vt.edu> From: Song Liu Date: Mon, 28 Jan 2019 09:18:45 -0800 Message-ID: Subject: Re: [PATCH] bpf/core.c - silence warning messages To: Valdis Kletnieks Cc: Alexei Starovoitov , Daniel Borkmann , Networking , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 27, 2019 at 8:43 PM wrote: > > Compiling kernel/bpf/core.c with W=1 causes a flood of warnings: > > kernel/bpf/core.c:1198:65: warning: initialized field overwritten [-Woverride-init] > 1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true > | ^~~~ > kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL' > 1087 | INSN_3(ALU, ADD, X), \ > | ^~~~~~ > kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' > 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), > | ^~~~~~~~~~~~ > kernel/bpf/core.c:1198:65: note: (near initialization for 'public_insntable[12]') > 1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true > | ^~~~ > kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL' > 1087 | INSN_3(ALU, ADD, X), \ > | ^~~~~~ > kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' > 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), > | ^~~~~~~~~~~~ > > 98 copies of the above. > > The attached patch silences the warnings, because we *know* we're overwriting > the default initializer. That leaves bpf/core.c with only 6 other warnings, > which become more visible in comparison. My concern is that this will also mute the warning for other parts of bpf/core.c. Maybe we should move bpf_opcode_in_insntable() to a separate file, and mute warning for that file? Daniel and Alexei, what do you think? Thanks, Song > > Signed-off-by: Valdis Kletnieks > > diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile > index 4c2fa3ac56f6..2606665f2cb5 100644 > --- a/kernel/bpf/Makefile > +++ b/kernel/bpf/Makefile > @@ -21,3 +21,4 @@ obj-$(CONFIG_CGROUP_BPF) += cgroup.o > ifeq ($(CONFIG_INET),y) > obj-$(CONFIG_BPF_SYSCALL) += reuseport_array.o > endif > +CFLAGS_core.o += $(call cc-disable-warning, override-init) >