All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Dan Carpenter <error27@gmail.com>
Cc: mcarlson@broadcom.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Michael Chan <mchan@broadcom.com>
Subject: Re: [PATCH] tg3: fix return value check in tg3_read_vpd()
Date: Wed, 29 Dec 2010 14:17:22 +0100	[thread overview]
Message-ID: <201012291417.24424.dsterba@suse.cz> (raw)
In-Reply-To: <20101227201927.GA6365@bicker>

Hi,

On Monday 27 December 2010 21:19:27 Dan Carpenter wrote:
> Your fix is obviously correct, but could you describe the symptoms
> in your changelog instead of leaving it blank?  In the original code,
> negative error values are ignored so we never goto out_not_found.  Can
> pci_read_vpd() return any errors we care about besides -ENODEV?  What I
> mean is, did you find this through analysing the code or did it cause a
> bug at runtime?

Although pci_read_vpd returns ENODEV directly, there is a call to vpd->read
function which may return other error values and is eg. set to
pci_vpd_pci22_read() :

drivers/pci/access.c::pci_vpd_pci22_read()
  may return -EINVAL or -EINTR directly
  or -ETIMEDOUT or -EINTR via pci_vpd_pci22_wait()

Yes, other negative values besides ETIMEDOUT and EINTR are ignored and after
3 attempts the pos != TG3_NVM_VPD_LEN check goes outwards. The fixed version
allows to jump out immediately. So this does not manifest itself as a 
misbehaviour at runtime. It was found by code analysis.

I'll post updated patch.

dave

  reply	other threads:[~2010-12-29 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27 17:31 [PATCH] tg3: fix return value check in tg3_read_vpd() David Sterba
2010-12-27 20:19 ` Dan Carpenter
2010-12-29 13:17   ` David Sterba [this message]
2010-12-29 13:40     ` [PATCH v2] " David Sterba
2010-12-31 20:31       ` David Miller

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=201012291417.24424.dsterba@suse.cz \
    --to=dsterba@suse.cz \
    --cc=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@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.