public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Aditya Pakki <pakki001@umn.edu>
Cc: devel@driverdev.osuosl.org, "Vandana BN" <bnvandana@gmail.com>,
	"Harsh Jain" <harshjain32@gmail.com>,
	kjlu@umn.edu, linux-kernel@vger.kernel.org,
	"Simon Sandström" <simon@nikanor.nu>
Subject: Re: [PATCH] staging: kpc2000: replace assertion with recovery code
Date: Sun, 15 Dec 2019 19:28:14 +0100	[thread overview]
Message-ID: <20191215182814.GA859066@kroah.com> (raw)
In-Reply-To: <20191215181243.31519-1-pakki001@umn.edu>

On Sun, Dec 15, 2019 at 12:12:37PM -0600, Aditya Pakki wrote:
> In kpc_dma_transfer, if either priv or ldev is NULL, crashing the
> process is excessive and is not needed. Instead of asserting, by
> passing the error upstream, the error can be handled.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/staging/kpc2000/kpc_dma/fileops.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c
> index cb52bd9a6d2f..1c4633267cc1 100644
> --- a/drivers/staging/kpc2000/kpc_dma/fileops.c
> +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
> @@ -49,9 +49,11 @@ static int kpc_dma_transfer(struct dev_private_data *priv,
>  	u64 dma_addr;
>  	u64 user_ctl;
>  
> -	BUG_ON(priv == NULL);
> +	if (!priv)
> +		return -EINVAL;

How can prive ever be NULL here?  Can you track back to all callers to
verify this?  If so, just remove the check.

thanks,

greg k-h

  reply	other threads:[~2019-12-15 18:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15 18:12 [PATCH] staging: kpc2000: replace assertion with recovery code Aditya Pakki
2019-12-15 18:28 ` Greg Kroah-Hartman [this message]
2020-01-03  8:49   ` Dan Carpenter

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=20191215182814.GA859066@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bnvandana@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=harshjain32@gmail.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=simon@nikanor.nu \
    /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