All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: bp@suse.de
Cc: linux-edac@vger.kernel.org
Subject: [bug report] x86/mce: Prevent severity computation from being instrumented
Date: Fri, 17 Dec 2021 13:20:29 +0300	[thread overview]
Message-ID: <20211217102029.GA29708@kili> (raw)

Hello Borislav Petkov,

This is a semi-automatic email about new static checker warnings.

The patch 0a5b288e85bb: "x86/mce: Prevent severity computation from
being instrumented" from Oct 13, 2021, leads to the following Smatch
complaint:

    arch/x86/kernel/cpu/mce/severity.c:286 error_context()
    warn: variable dereferenced before check 'regs' (see line 280)

arch/x86/kernel/cpu/mce/severity.c
   279		fixup_type = ex_get_fixup_type(m->ip);
   280		copy_user  = is_copy_from_user(regs);
                                               ^^^^
New unchecked dereference

   281		instrumentation_end();
   282	
   283		switch (fixup_type) {
   284		case EX_TYPE_UACCESS:
   285		case EX_TYPE_COPY:
   286			if (!regs || !copy_user)
                             ^^^^
Old code checked for NULL

   287				return IN_KERNEL;
   288			m->kflags |= MCE_IN_KERNEL_COPYIN;

regards,
dan carpenter

             reply	other threads:[~2021-12-17 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 10:20 Dan Carpenter [this message]
2021-12-17 11:29 ` [bug report] x86/mce: Prevent severity computation from being instrumented Borislav Petkov
2021-12-17 17:13   ` Luck, Tony
2021-12-17 23:50     ` [PATCH] x86/mce: Check regs before accessing it Borislav Petkov
2021-12-20 10:48 ` [tip: ras/core] " tip-bot2 for Borislav Petkov

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=20211217102029.GA29708@kili \
    --to=dan.carpenter@oracle.com \
    --cc=bp@suse.de \
    --cc=linux-edac@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.