All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lisa Nguyen <lisa@xenapiadmin.com>,
	devel@driverdev.osuosl.org, Wenliang Fan <fanwlexca@gmail.com>,
	linux-kernel@vger.kernel.org,
	Rashika Kheria <rashika.kheria@gmail.com>,
	Tugce Sirin <ztugcesirin@gmail.com>,
	Aldo Iljazi <neonsync1@gmail.com>
Subject: Re: [PATCH] staging: bcm: nvm.c: Cleaning up a array that is filled incompletely
Date: Mon, 9 Jun 2014 17:09:51 +0300	[thread overview]
Message-ID: <20140609140738.GD5500@mwanda> (raw)
In-Reply-To: <1402263928-1961-2-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Sun, Jun 08, 2014 at 11:45:28PM +0200, Rickard Strandqvist wrote:
> Array 'SigBuff' is filled incompletely.
> Someone forget to multiply for the sizeof type.
> 
> This was partly found using a static code analysis program called cppcheck.
> 

I took a look at code which uses MAX_RW_SIZE and it's really confused
about whether it is in bytes or number of ints.

This code is a real mess.  For example, look at the call to:

			WriteToFlashWithoutSectorErase(Adapter,
                                                       SigBuff,
                                                       eISOWritePart,
                                                       sigOffset,
                                                       MAX_RW_SIZE);

If you look at it, that function says it takes int pointers but really
I think it wants u8 pointers.

I think this is the real fix here, to change
WriteToFlashWithoutSectorErase() to take char pointers and then make the
SigBuff buffer an array of u8.

I think this is the correct way to fix this code, but this driver is
very horrible so I could be wrong.  Please check.

regards,
dan carpenter

PS: These days I add everything to the TODO so we don't forget about it.

TODO-list: 2014-06-09: bcm: make SigBuff in BcmCopyISO() an array of u8.



      reply	other threads:[~2014-06-09 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-08 21:45 [PATCH] staging: bcm: nvm.c: Cleaning up a array that is filled incompletely Rickard Strandqvist
2014-06-08 21:45 ` Rickard Strandqvist
2014-06-09 14:09   ` Dan Carpenter [this message]

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=20140609140738.GD5500@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fanwlexca@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lisa@xenapiadmin.com \
    --cc=neonsync1@gmail.com \
    --cc=rashika.kheria@gmail.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=ztugcesirin@gmail.com \
    /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.