linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: bhe@redhat.com
Cc: linux-mm@kvack.org
Subject: [bug report] mm/vmalloc: explicitly identify vm_map_ram area when shown in /proc/vmcoreinfo
Date: Tue, 17 Jan 2023 14:03:54 +0300	[thread overview]
Message-ID: <Y8aAmuUY9OxrYlLm@kili> (raw)

Hello Baoquan He,

This static checker warning is related to yesterdays, but more straight
forward to analyze.

The patch ae5dfc510155: "mm/vmalloc: explicitly identify vm_map_ram
area when shown in /proc/vmcoreinfo" from Jan 13, 2023, leads to the
following Smatch static checker warning:

	mm/vmalloc.c:4244 s_show()
	error: we previously assumed 'v' could be null (see line 4241)

mm/vmalloc.c
    4226 static int s_show(struct seq_file *m, void *p)
    4227 {
    4228         struct vmap_area *va;
    4229         struct vm_struct *v;
    4230 
    4231         va = list_entry(p, struct vmap_area, list);
    4232 
    4233         if (!va->vm && (va->flags & VMAP_RAM)) {
                      ^^^^^^     ^^^^^^^^^^^^^^^^^^^^
Assume va->vm is NULL but the VMAP_RAM flag is not set.

    4234                 seq_printf(m, "0x%pK-0x%pK %7ld vm_map_ram\n",
    4235                         (void *)va->va_start, (void *)va->va_end,
    4236                         va->va_end - va->va_start);
    4237 
    4238                 goto final;
    4239         }
    4240 
    4241         v = va->vm;
                 ^^^^^^^^^^
Assignment

    4242 
    4243         seq_printf(m, "0x%pK-0x%pK %7ld",
--> 4244                 v->addr, v->addr + v->size, v->size);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dead.

    4245 
    4246         if (v->caller)
    4247                 seq_printf(m, " %pS", v->caller);
    4248 

regards,
dan carpenter


             reply	other threads:[~2023-01-17 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 11:03 Dan Carpenter [this message]
2023-01-18  2:03 ` Baoquan He

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=Y8aAmuUY9OxrYlLm@kili \
    --to=error27@gmail.com \
    --cc=bhe@redhat.com \
    --cc=linux-mm@kvack.org \
    /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