mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Colin King <colin.king@canonical.com>,
	Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-integrity@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: st33zp24: remove redundant null check on chip
Date: Mon, 09 Apr 2018 14:11:08 +0300	[thread overview]
Message-ID: <4ea103c15998af56813fb870ac9a27a34a694f49.camel@linux.intel.com> (raw)
In-Reply-To: <20180406162144.14717-1-colin.king@canonical.com>

On Fri, 2018-04-06 at 17:21 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently chip is being dereferenced by the call to dev_get_drvdata
> before it is being null checked, however, chip can never be null, so
> this check is misleading and redundant. Remove it.
> 
> Detected by CoverityScan, CID#1357806 ("Dereference before null check")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> ---
> 
> V2: don't check for null, just remove redundant null check,
>     thanks to Jason Gunthorpe for spotting that.
> 
> ---
>  drivers/char/tpm/st33zp24/st33zp24.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/st33zp24/st33zp24.c
> b/drivers/char/tpm/st33zp24/st33zp24.c
> index f95b9c75175b..abd675bec88c 100644
> --- a/drivers/char/tpm/st33zp24/st33zp24.c
> +++ b/drivers/char/tpm/st33zp24/st33zp24.c
> @@ -373,8 +373,6 @@ static int st33zp24_send(struct tpm_chip *chip, unsigned
> char *buf,
>  	int ret;
>  	u8 data;
>  
> -	if (!chip)
> -		return -EBUSY;
>  	if (len < TPM_HEADER_SIZE)
>  		return -EBUSY;
>  

Reviewed-by: Jarkko Sakkinen <jarkkko.sakkinen@linux.intel.com>

/Jarkko

      reply	other threads:[~2018-04-09 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 16:21 Colin King
2018-04-09 11:11 ` Jarkko Sakkinen [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=4ea103c15998af56813fb870ac9a27a34a694f49.camel@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /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

all inboxes | Powered by JetHome®