public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kashyap.desai@lsi.com
Cc: linux-scsi@vger.kernel.org
Subject: re: [SCSI] mpt2sas: Fixed Big Indian Issues on 32 bit PPC
Date: Mon, 20 Feb 2012 17:05:38 +0300	[thread overview]
Message-ID: <20120220140538.GA750@elgon.mountain> (raw)

Hello Kashyap, Desai,

The patch c97951ec46d4: "[SCSI] mpt2sas: Fixed Big Indian Issues on 
32 bit PPC" from Jun 14, 2011, leads to the following static checker
warning:

drivers/scsi/mpt2sas/mpt2sas_base.c:3352 _base_get_port_facts()
	 warn: are we memsetting too much? 6 vs 28

We changed the size of certain data structures.

-       Mpi2IOCFactsReply_t facts;
-       Mpi2PortFactsReply_t *pfacts;
+       struct mpt2sas_facts facts;
+       struct mpt2sas_port_facts *pfacts;

But it's not done consistently.  We still memset it as if it were the
original size.

	memset(facts, 0, sizeof(Mpi2IOCFactsReply_t));

And we still allocate the original size data structure:

  4270          ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
  4271              sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);

There are a couple other warnings as well.
drivers/scsi/mpt2sas/mpt2sas_base.c:3394 _base_get_ioc_facts(24)
	warn: are we memsetting too much? 60 vs 64
drivers/scsi/mpt2sas/mpt2sas_base.c:4270 mpt2sas_base_attach(56)
	warn: double check that we're allocating correct size: 6 vs 28

Obviously the concern with a too big memset is that we're corrupting
the next element in the array or we're corrupting past the end of the
array.

regards,
dan carpenter


             reply	other threads:[~2012-02-20 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 14:05 Dan Carpenter [this message]
2012-02-20 23:15 ` [SCSI] mpt2sas: Fixed Big Indian Issues on 32 bit PPC Moore, Eric

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=20120220140538.GA750@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kashyap.desai@lsi.com \
    --cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox