All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Michael Estner <michaelestner@web.de>
Cc: Lee Jones <lee.jones@linaro.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] avoid crashing the kernel
Date: Sun, 26 Sep 2021 08:51:46 +0200	[thread overview]
Message-ID: <YVAYgp+XnCkjPigd@kroah.com> (raw)
In-Reply-To: <20210925200433.8329-1-michaelestner@web.de>

On Sat, Sep 25, 2021 at 10:04:30PM +0200, Michael Estner wrote:
> To avoid chrashing the kernel I use WARN_ON instead.
> 
> Signed-off-by: Michael Estner <michaelestner@web.de>
> ---
>  drivers/staging/most/i2c/i2c.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Hi,

First off, thanks for the changes, but they need a bit more work.

Your subject line should match the others done for this file, so you
need a "staging: most:" prefix like others.  To see this better, do:
	git log --oneline the_file_i_am_touching.c


Also take a look at the kernel documentation for how to write a good
changelog text.  Your wording above needs some work...

> diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c
> index 7042f10887bb..e1edd892f9fd 100644
> --- a/drivers/staging/most/i2c/i2c.c
> +++ b/drivers/staging/most/i2c/i2c.c
> @@ -68,7 +68,7 @@ static int configure_channel(struct most_interface *most_iface,
>  	struct hdm_i2c *dev = to_hdm(most_iface);
>  	unsigned int delay, pr;
> 
> -	BUG_ON(ch_idx < 0 || ch_idx >= NUM_CHANNELS);
> +	WARN_ON(ch_idx < 0 || ch_idx >= NUM_CHANNELS);

You really aren't changing much here, for systems running with "panic on
warn", right?

To solve this correctly you should either:
	- determine that these are impossible to hit and remove the test
	  entirely
	- determine that these are possible to hit, and turn them into a
	  real test and handle the error properly.

thanks,

greg k-h

  reply	other threads:[~2021-09-26  6:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 20:04 [PATCH] avoid crashing the kernel Michael Estner
2021-09-26  6:51 ` Greg Kroah-Hartman [this message]
2021-09-26  8:38 ` Fabio M. De Francesco
2021-09-27 13:15 ` 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=YVAYgp+XnCkjPigd@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=michaelestner@web.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 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.