linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, John Ogness <john.ogness@linutronix.de>,
	Petr Mladek <pmladek@suse.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrea Parri <parri.andrea@gmail.com>,
	Paul McKenney <paulmck@kernel.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH printk v4 5/6] printk: ringbuffer: add finalization/extension support
Date: Wed, 9 Sep 2020 13:40:21 +0300	[thread overview]
Message-ID: <20200909100231.GM8299@kadam> (raw)
In-Reply-To: <20200908202859.2736-6-john.ogness@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 7264 bytes --]

Hi John,

url:    https://github.com/0day-ci/linux/commits/John-Ogness/printk-reimplement-LOG_CONT-handling/20200909-115852
base:    dff9f829e5b0181d4ed9d35aa62d695292399b54
config: x86_64-randconfig-m001-20200909 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
kernel/printk/printk_ringbuffer.c:1385 prb_reserve_in_last() error: uninitialized symbol 'data_size'.

# https://github.com/0day-ci/linux/commit/4b08e95d4858fb7e2fe1732aa7f4f6f6881eac91
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review John-Ogness/printk-reimplement-LOG_CONT-handling/20200909-115852
git checkout 4b08e95d4858fb7e2fe1732aa7f4f6f6881eac91
vim +/data_size +1385 kernel/printk/printk_ringbuffer.c

4b08e95d4858fb John Ogness 2020-09-08  1346  bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer *rb,
4b08e95d4858fb John Ogness 2020-09-08  1347  			 struct printk_record *r, u32 caller_id)
4b08e95d4858fb John Ogness 2020-09-08  1348  {
4b08e95d4858fb John Ogness 2020-09-08  1349  	unsigned int data_size;
4b08e95d4858fb John Ogness 2020-09-08  1350  	struct prb_desc *d;
4b08e95d4858fb John Ogness 2020-09-08  1351  	unsigned long id;
4b08e95d4858fb John Ogness 2020-09-08  1352  
4b08e95d4858fb John Ogness 2020-09-08  1353  	local_irq_save(e->irqflags);
4b08e95d4858fb John Ogness 2020-09-08  1354  
4b08e95d4858fb John Ogness 2020-09-08  1355  	/* Transition the newest descriptor back to the reserved state. */
4b08e95d4858fb John Ogness 2020-09-08  1356  	d = desc_reopen_last(&rb->desc_ring, caller_id, &id);
4b08e95d4858fb John Ogness 2020-09-08  1357  	if (!d) {
4b08e95d4858fb John Ogness 2020-09-08  1358  		local_irq_restore(e->irqflags);
4b08e95d4858fb John Ogness 2020-09-08  1359  		goto fail_reopen;
4b08e95d4858fb John Ogness 2020-09-08  1360  	}
4b08e95d4858fb John Ogness 2020-09-08  1361  
4b08e95d4858fb John Ogness 2020-09-08  1362  	/* Now the writer has exclusive access: LMM(prb_reserve_in_last:A) */
4b08e95d4858fb John Ogness 2020-09-08  1363  
4b08e95d4858fb John Ogness 2020-09-08  1364  	/*
4b08e95d4858fb John Ogness 2020-09-08  1365  	 * Set the @e fields here so that prb_commit() can be used if
4b08e95d4858fb John Ogness 2020-09-08  1366  	 * anything fails from now on.
4b08e95d4858fb John Ogness 2020-09-08  1367  	 */
4b08e95d4858fb John Ogness 2020-09-08  1368  	e->rb = rb;
4b08e95d4858fb John Ogness 2020-09-08  1369  	e->id = id;
4b08e95d4858fb John Ogness 2020-09-08  1370  
4b08e95d4858fb John Ogness 2020-09-08  1371  	/*
4b08e95d4858fb John Ogness 2020-09-08  1372  	 * desc_reopen_last() checked the caller_id, but there was no
4b08e95d4858fb John Ogness 2020-09-08  1373  	 * exclusive access at that point. The descriptor may have
4b08e95d4858fb John Ogness 2020-09-08  1374  	 * changed since then.
4b08e95d4858fb John Ogness 2020-09-08  1375  	 */
4b08e95d4858fb John Ogness 2020-09-08  1376  	if (caller_id != d->info.caller_id)
4b08e95d4858fb John Ogness 2020-09-08  1377  		goto fail;
4b08e95d4858fb John Ogness 2020-09-08  1378  
4b08e95d4858fb John Ogness 2020-09-08  1379  	if (BLK_DATALESS(&d->text_blk_lpos)) {
4b08e95d4858fb John Ogness 2020-09-08  1380  		r->text_buf = data_alloc(rb, &rb->text_data_ring, r->text_buf_size,
4b08e95d4858fb John Ogness 2020-09-08  1381  					 &d->text_blk_lpos, id);
4b08e95d4858fb John Ogness 2020-09-08  1382  		if (WARN_ON_ONCE(d->info.text_len != 0)) {
4b08e95d4858fb John Ogness 2020-09-08  1383  			pr_warn_once("wrong text_len value (%u, expecting 0)\n",
4b08e95d4858fb John Ogness 2020-09-08  1384  				     d->info.text_len);
4b08e95d4858fb John Ogness 2020-09-08 @1385  			d->info.text_len = data_size;
                                                                                   ^^^^^^^^^
Not initialized yet.

4b08e95d4858fb John Ogness 2020-09-08  1386  		}
4b08e95d4858fb John Ogness 2020-09-08  1387  	} else {
4b08e95d4858fb John Ogness 2020-09-08  1388  		if (!get_data(&rb->text_data_ring, &d->text_blk_lpos, &data_size))
                                                                                                              ^^^^^^^^^^

4b08e95d4858fb John Ogness 2020-09-08  1389  			goto fail;
4b08e95d4858fb John Ogness 2020-09-08  1390  
4b08e95d4858fb John Ogness 2020-09-08  1391  		/*
4b08e95d4858fb John Ogness 2020-09-08  1392  		 * Increase the buffer size to include the original size. If
4b08e95d4858fb John Ogness 2020-09-08  1393  		 * the meta data (@text_len) is not sane, use the full data
4b08e95d4858fb John Ogness 2020-09-08  1394  		 * block size.
4b08e95d4858fb John Ogness 2020-09-08  1395  		 */
4b08e95d4858fb John Ogness 2020-09-08  1396  		if (WARN_ON_ONCE(d->info.text_len > data_size)) {
4b08e95d4858fb John Ogness 2020-09-08  1397  			pr_warn_once("wrong text_len value (%u, expecting <=%hu)\n",
4b08e95d4858fb John Ogness 2020-09-08  1398  				     d->info.text_len, data_size);
4b08e95d4858fb John Ogness 2020-09-08  1399  			d->info.text_len = data_size;
4b08e95d4858fb John Ogness 2020-09-08  1400  		}
4b08e95d4858fb John Ogness 2020-09-08  1401  		r->text_buf_size += d->info.text_len;
4b08e95d4858fb John Ogness 2020-09-08  1402  
4b08e95d4858fb John Ogness 2020-09-08  1403  		if (!data_check_size(&rb->text_data_ring, r->text_buf_size))
4b08e95d4858fb John Ogness 2020-09-08  1404  			goto fail;
4b08e95d4858fb John Ogness 2020-09-08  1405  
4b08e95d4858fb John Ogness 2020-09-08  1406  		r->text_buf = data_realloc(rb, &rb->text_data_ring, r->text_buf_size,
4b08e95d4858fb John Ogness 2020-09-08  1407  					   &d->text_blk_lpos, id);
4b08e95d4858fb John Ogness 2020-09-08  1408  	}
4b08e95d4858fb John Ogness 2020-09-08  1409  	if (r->text_buf_size && !r->text_buf)
4b08e95d4858fb John Ogness 2020-09-08  1410  		goto fail;
4b08e95d4858fb John Ogness 2020-09-08  1411  
4b08e95d4858fb John Ogness 2020-09-08  1412  	/* Although dictionary data may be in use, it cannot be extended. */
4b08e95d4858fb John Ogness 2020-09-08  1413  	r->dict_buf = NULL;
4b08e95d4858fb John Ogness 2020-09-08  1414  	r->dict_buf_size = 0;
4b08e95d4858fb John Ogness 2020-09-08  1415  
4b08e95d4858fb John Ogness 2020-09-08  1416  	r->info = &d->info;
4b08e95d4858fb John Ogness 2020-09-08  1417  
4b08e95d4858fb John Ogness 2020-09-08  1418  	e->text_space = space_used(&rb->text_data_ring, &d->text_blk_lpos);
4b08e95d4858fb John Ogness 2020-09-08  1419  
4b08e95d4858fb John Ogness 2020-09-08  1420  	return true;
4b08e95d4858fb John Ogness 2020-09-08  1421  fail:
4b08e95d4858fb John Ogness 2020-09-08  1422  	prb_commit(e);
4b08e95d4858fb John Ogness 2020-09-08  1423  	/* prb_commit() re-enabled interrupts. */
4b08e95d4858fb John Ogness 2020-09-08  1424  fail_reopen:
4b08e95d4858fb John Ogness 2020-09-08  1425  	/* Make it clear to the caller that the re-reserve failed. */
4b08e95d4858fb John Ogness 2020-09-08  1426  	memset(r, 0, sizeof(*r));
4b08e95d4858fb John Ogness 2020-09-08  1427  	return false;
4b08e95d4858fb John Ogness 2020-09-08  1428  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50301 bytes --]

  parent reply	other threads:[~2020-09-09 10:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 20:28 [PATCH printk v4 0/6] printk: reimplement LOG_CONT handling John Ogness
2020-09-08 20:28 ` [PATCH printk v4 1/6] printk: ringbuffer: relocate get_data() John Ogness
2020-09-08 20:28 ` [PATCH printk v4 2/6] printk: ringbuffer: add BLK_DATALESS() macro John Ogness
2020-09-08 20:28 ` [PATCH printk v4 3/6] printk: ringbuffer: clear initial reserved fields John Ogness
2020-09-09  9:34   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 4/6] printk: ringbuffer: change representation of states John Ogness
2020-09-09 10:01   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 5/6] printk: ringbuffer: add finalization/extension support John Ogness
2020-09-09  6:50   ` kernel test robot
2020-09-09 10:40   ` Dan Carpenter [this message]
2020-09-09 15:22   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 6/6] printk: reimplement log_cont using record extension John Ogness

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200909100231.GM8299@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).