Content-Type: multipart/mixed; boundary="===============8088752858996156630==" MIME-Version: 1.0 From: Petr Mladek To: kbuild-all@lists.01.org Subject: Re: [PATCH] printk/console: Check consistent sequence number when handling race in console_unlock() Date: Wed, 30 Jun 2021 10:57:46 +0200 Message-ID: In-Reply-To: <87zgv8bdei.fsf@jogness.linutronix.de> List-Id: --===============8088752858996156630== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue 2021-06-29 22:59:57, John Ogness wrote: > On 2021-06-30, kernel test robot wrote: > >>> kernel/printk/printk.c:2548:6: warning: variable 'next_seq' set but n= ot used [-Wunused-but-set-variable] > = > I suppose the correct fix for this warning would be to change the NOP > macros. Currently they are: > = > #define prb_read_valid(rb, seq, r) false > #define prb_first_valid_seq(rb) 0 > = > They should probably be something like (untested): > = > #define prb_read_valid(rb, seq, r) \ > ({ \ > (void)(rb); \ > (void)(seq); \ > (void)(r); \ > false; \ > }) This did not work: kernel/printk/printk.c: In function =E2=80=98console_unlock=E2=80=99: kernel/printk/printk.c:2600:23: error: =E2=80=98prb=E2=80=99 undeclared (fi= rst use in this function) if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro =E2=80=98prb_r= ead_valid=E2=80=99 (void)(rb); \ ^~ kernel/printk/printk.c:2600:23: note: each undeclared identifier is reporte= d only once for each function it appears in if (!prb_read_valid(prb, console_seq, &r)) ^ kernel/printk/printk.c:2230:16: note: in definition of macro =E2=80=98prb_r= ead_valid=E2=80=99 (void)(rb); \ ^~ Instead, it might be solved by declaring next_seq as: u64 __maybe_unused next_seq; Any better idea is welcome. Well, it is not worth any big complexity. Best Regards, Petr --===============8088752858996156630==--