From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Man Choy <manchoyy@gmail.com>
Cc: bhumirks@gmail.com, Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bcm2048: Fix checkpatch checks
Date: Mon, 27 Feb 2017 09:21:31 +0100 [thread overview]
Message-ID: <20170227082131.GA18819@kroah.com> (raw)
In-Reply-To: <1487389982-26131-1-git-send-email-manchoyy@gmail.com>
On Sat, Feb 18, 2017 at 11:52:37AM +0800, Man Choy wrote:
> Fix following checks:
>
> CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
> + BUG_ON((index+2) >= BCM2048_MAX_RDS_RT);
>
> CHECK: spaces preferred around that '+' (ctx:VxV)
> + BUG_ON((index+2) >= BCM2048_MAX_RDS_RT);
> ^
>
> CHECK: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()
> + BUG_ON((index+4) >= BCM2048_MAX_RDS_RT);
>
> CHECK: spaces preferred around that '+' (ctx:VxV)
> + BUG_ON((index+4) >= BCM2048_MAX_RDS_RT);
> ^
> ---
> drivers/staging/media/bcm2048/radio-bcm2048.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
> index 37bd439..d5ee279 100644
> --- a/drivers/staging/media/bcm2048/radio-bcm2048.c
> +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
> @@ -1534,7 +1534,7 @@ static int bcm2048_parse_rt_match_c(struct bcm2048_device *bdev, int i,
> if (crc == BCM2048_RDS_CRC_UNRECOVARABLE)
> return 0;
>
> - BUG_ON((index+2) >= BCM2048_MAX_RDS_RT);
> + WARN_ON((index + 2) >= BCM2048_MAX_RDS_RT);
Ick, no to all of these! What happens if this is true, the code will
crash, right? You have to properly recover from this, don't just throw
the message out to userspace and then keep on going.
You can't just do a search/replace for this, otherwise it would have
been done already :)
thanks,
greg k-h
next prev parent reply other threads:[~2017-02-27 8:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-18 3:52 [PATCH] bcm2048: Fix checkpatch checks Man Choy
2017-02-27 8:21 ` Greg Kroah-Hartman [this message]
2017-02-28 1:07 ` Man Choy
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=20170227082131.GA18819@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bhumirks@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=manchoyy@gmail.com \
--cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox