All of lore.kernel.org
 help / color / mirror / Atom feed
From: dan.carpenter@oracle.com (Dan Carpenter)
To: linux-arm-kernel@lists.infradead.org
Subject: [bug report] ARM: sun9i: smp: Add is_a83t field
Date: Thu, 17 May 2018 15:39:02 +0300	[thread overview]
Message-ID: <20180517123902.GA8759@mwanda> (raw)

Hello Myl?ne Josserand,

The patch 1631090e34f5: "ARM: sun9i: smp: Add is_a83t field" from May
4, 2018, leads to the following static checker warning:

	arch/arm/mach-sunxi/mc_smp.c:804 sunxi_mc_smp_init()
	error: buffer overflow 'sunxi_mc_smp_data' 2 <= 2 (assuming for loop doesn't break)

arch/arm/mach-sunxi/mc_smp.c
   789          /*
   790           * We can't actually use the enable-method magic in the kernel.
   791           * Our loopback / trampoline code uses the CPU suspend framework,
   792           * which requires the identity mapping be available. It would not
   793           * yet be available if we used the .init_cpus or .prepare_cpus
   794           * callbacks in smp_operations, which we would use if we were to
   795           * use CPU_METHOD_OF_DECLARE
   796           */
   797          for (i = 0; i < ARRAY_SIZE(sunxi_mc_smp_data); i++) {
   798                  ret = of_property_match_string(node, "enable-method",
   799                                                 sunxi_mc_smp_data[i].enable_method);
   800                  if (!ret)
   801                          break;
   802          }
   803  
   804          is_a83t = sunxi_mc_smp_data[i].is_a83t;
                          ^^^^^^^^^^^^^^^^^^^^
Potentially one past the end.

   805  
   806          of_node_put(node);
   807          if (ret)
   808                  return -ENODEV;
                        ^^^^^^^^^^^^^^
This is where we return if we don't hit a break.

   809  

regards,
dan carpenter

                 reply	other threads:[~2018-05-17 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180517123902.GA8759@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.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.