* [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
@ 2014-07-18 15:34 ` Andrey Utkin
0 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2014-07-18 15:34 UTC (permalink / raw)
To: linux-kernel, kernel-janitors, kgdb-bugreport
Cc: dcb314, jason.wessel, Andrey Utkin
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80591
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
---
kernel/debug/kdb/kdb_bp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/debug/kdb/kdb_bp.c b/kernel/debug/kdb/kdb_bp.c
index 70a5046..f27dfb8 100644
--- a/kernel/debug/kdb/kdb_bp.c
+++ b/kernel/debug/kdb/kdb_bp.c
@@ -39,7 +39,7 @@ static char *kdb_rwtypes[] = {
static char *kdb_bptype(kdb_bp_t *bp)
{
- if (bp->bp_type < 0 || bp->bp_type > 4)
+ if (bp->bp_type > 4)
return "";
return kdb_rwtypes[bp->bp_type];
--
1.8.5.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
@ 2014-07-18 15:34 ` Andrey Utkin
0 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2014-07-18 15:34 UTC (permalink / raw)
To: linux-kernel, kernel-janitors, kgdb-bugreport
Cc: dcb314, jason.wessel, Andrey Utkin
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id€591
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
---
kernel/debug/kdb/kdb_bp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/debug/kdb/kdb_bp.c b/kernel/debug/kdb/kdb_bp.c
index 70a5046..f27dfb8 100644
--- a/kernel/debug/kdb/kdb_bp.c
+++ b/kernel/debug/kdb/kdb_bp.c
@@ -39,7 +39,7 @@ static char *kdb_rwtypes[] = {
static char *kdb_bptype(kdb_bp_t *bp)
{
- if (bp->bp_type < 0 || bp->bp_type > 4)
+ if (bp->bp_type > 4)
return "";
return kdb_rwtypes[bp->bp_type];
--
1.8.5.5
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
2014-07-18 15:34 ` Andrey Utkin
@ 2014-07-18 17:18 ` walter harms
-1 siblings, 0 replies; 8+ messages in thread
From: walter harms @ 2014-07-18 17:18 UTC (permalink / raw)
To: Andrey Utkin
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
Am 18.07.2014 17:34, schrieb Andrey Utkin:
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80591
> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
> ---
> kernel/debug/kdb/kdb_bp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/debug/kdb/kdb_bp.c b/kernel/debug/kdb/kdb_bp.c
> index 70a5046..f27dfb8 100644
> --- a/kernel/debug/kdb/kdb_bp.c
> +++ b/kernel/debug/kdb/kdb_bp.c
> @@ -39,7 +39,7 @@ static char *kdb_rwtypes[] = {
>
> static char *kdb_bptype(kdb_bp_t *bp)
> {
> - if (bp->bp_type < 0 || bp->bp_type > 4)
> + if (bp->bp_type > 4)
> return "";
>
> return kdb_rwtypes[bp->bp_type];
i would expect a ckeck for the upper limit with ARRAY_SIZE(bp->bp_type) here.
re,
wh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
@ 2014-07-18 17:18 ` walter harms
0 siblings, 0 replies; 8+ messages in thread
From: walter harms @ 2014-07-18 17:18 UTC (permalink / raw)
To: Andrey Utkin
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
Am 18.07.2014 17:34, schrieb Andrey Utkin:
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id€591
> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
> ---
> kernel/debug/kdb/kdb_bp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/debug/kdb/kdb_bp.c b/kernel/debug/kdb/kdb_bp.c
> index 70a5046..f27dfb8 100644
> --- a/kernel/debug/kdb/kdb_bp.c
> +++ b/kernel/debug/kdb/kdb_bp.c
> @@ -39,7 +39,7 @@ static char *kdb_rwtypes[] = {
>
> static char *kdb_bptype(kdb_bp_t *bp)
> {
> - if (bp->bp_type < 0 || bp->bp_type > 4)
> + if (bp->bp_type > 4)
> return "";
>
> return kdb_rwtypes[bp->bp_type];
i would expect a ckeck for the upper limit with ARRAY_SIZE(bp->bp_type) here.
re,
wh
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
2014-07-18 17:18 ` walter harms
@ 2014-07-18 17:41 ` Andrey Utkin
-1 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2014-07-18 17:41 UTC (permalink / raw)
To: wharms
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
2014-07-18 20:18 GMT+03:00 walter harms <wharms@bfs.de>:
> i would expect a ckeck for the upper limit with ARRAY_SIZE
Thanks, resubmitted.
--
Andrey Utkin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
@ 2014-07-18 17:41 ` Andrey Utkin
0 siblings, 0 replies; 8+ messages in thread
From: Andrey Utkin @ 2014-07-18 17:41 UTC (permalink / raw)
To: wharms
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
2014-07-18 20:18 GMT+03:00 walter harms <wharms@bfs.de>:
> i would expect a ckeck for the upper limit with ARRAY_SIZE
Thanks, resubmitted.
--
Andrey Utkin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
2014-07-18 15:34 ` Andrey Utkin
@ 2014-07-22 7:47 ` Dan Carpenter
-1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-07-22 7:47 UTC (permalink / raw)
To: Andrey Utkin
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
On Fri, Jul 18, 2014 at 06:34:52PM +0300, Andrey Utkin wrote:
> static char *kdb_bptype(kdb_bp_t *bp)
> {
> - if (bp->bp_type < 0 || bp->bp_type > 4)
> + if (bp->bp_type > 4)
> return "";
With Smatch, I ignore negative checks in this format. It's obvious what
the intent is and they are harmless. Patching them requires a little
review to make sure that someone isn't introducing a bug and can't be
done directly in the email client.
On the other hand, in Smatch I do complain about checks like:
if (bp->bp_type > 4 || bp->bp_type < 0)
Because only backwards thinking people write checks like that.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
@ 2014-07-22 7:47 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-07-22 7:47 UTC (permalink / raw)
To: Andrey Utkin
Cc: linux-kernel, kernel-janitors, kgdb-bugreport, dcb314, jason.wessel
On Fri, Jul 18, 2014 at 06:34:52PM +0300, Andrey Utkin wrote:
> static char *kdb_bptype(kdb_bp_t *bp)
> {
> - if (bp->bp_type < 0 || bp->bp_type > 4)
> + if (bp->bp_type > 4)
> return "";
With Smatch, I ignore negative checks in this format. It's obvious what
the intent is and they are harmless. Patching them requires a little
review to make sure that someone isn't introducing a bug and can't be
done directly in the email client.
On the other hand, in Smatch I do complain about checks like:
if (bp->bp_type > 4 || bp->bp_type < 0)
Because only backwards thinking people write checks like that.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-07-22 7:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 15:34 [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value Andrey Utkin
2014-07-18 15:34 ` Andrey Utkin
2014-07-18 17:18 ` walter harms
2014-07-18 17:18 ` walter harms
2014-07-18 17:41 ` Andrey Utkin
2014-07-18 17:41 ` Andrey Utkin
2014-07-22 7:47 ` Dan Carpenter
2014-07-22 7:47 ` Dan Carpenter
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.