* [PATCH] test: fix misplaced braces in strncmp call
@ 2014-11-19 9:06 Bruce Richardson
[not found] ` <1416387973-28431-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2014-11-19 9:06 UTC (permalink / raw)
To: dev-VfR2kkLFssw
This patch fixes two occurances where a call to strncmp had the closing
brace in the wrong place. Changing this form:
if (strncmp(X,Y,sizeof(X) != 0))
which does a comparison of length 1, to
if (strncmp(X,Y,sizeof(X)) != 0)
which does the correct length comparison and then compares the result to
zero in the "if" part, as the author presumably originally intended.
Reported-by: Larry Wang <liang-min.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
app/test/test_devargs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index f0acf8e..dcbdd09 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -90,9 +90,9 @@ test_devargs(void)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
if (strncmp(devargs->virtual.drv_name, "eth_ring1",
- sizeof(devargs->virtual.drv_name) != 0))
+ sizeof(devargs->virtual.drv_name)) != 0)
goto fail;
- if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) != 0))
+ if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args)) != 0)
goto fail;
free_devargs_list();
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1416387973-28431-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] test: fix misplaced braces in strncmp call [not found] ` <1416387973-28431-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2014-11-19 10:20 ` Olivier MATZ [not found] ` <546C6EF3.1080507-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Olivier MATZ @ 2014-11-19 10:20 UTC (permalink / raw) To: Bruce Richardson, dev-VfR2kkLFssw Hi Bruce, On 11/19/2014 10:06 AM, Bruce Richardson wrote: > This patch fixes two occurances where a call to strncmp had the closing > brace in the wrong place. Changing this form: > if (strncmp(X,Y,sizeof(X) != 0)) > which does a comparison of length 1, to > if (strncmp(X,Y,sizeof(X)) != 0) > which does the correct length comparison and then compares the result to > zero in the "if" part, as the author presumably originally intended. > > Reported-by: Larry Wang <liang-min.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Signed-off-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > app/test/test_devargs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c > index f0acf8e..dcbdd09 100644 > --- a/app/test/test_devargs.c > +++ b/app/test/test_devargs.c > @@ -90,9 +90,9 @@ test_devargs(void) > goto fail; > devargs = TAILQ_FIRST(&devargs_list); > if (strncmp(devargs->virtual.drv_name, "eth_ring1", > - sizeof(devargs->virtual.drv_name) != 0)) > + sizeof(devargs->virtual.drv_name)) != 0) > goto fail; > - if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) != 0)) > + if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args)) != 0) > goto fail; > free_devargs_list(); > > Nice catch! Acked-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <546C6EF3.1080507-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] test: fix misplaced braces in strncmp call [not found] ` <546C6EF3.1080507-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2014-11-24 15:54 ` Thomas Monjalon 0 siblings, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2014-11-24 15:54 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev-VfR2kkLFssw, Larry Wang > > This patch fixes two occurances where a call to strncmp had the closing > > brace in the wrong place. Changing this form: > > if (strncmp(X,Y,sizeof(X) != 0)) > > which does a comparison of length 1, to > > if (strncmp(X,Y,sizeof(X)) != 0) > > which does the correct length comparison and then compares the result to > > zero in the "if" part, as the author presumably originally intended. > > > > Reported-by: Larry Wang <liang-min.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Signed-off-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Nice catch! > > Acked-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> Applied Thanks -- Thomas ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-24 15:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19 9:06 [PATCH] test: fix misplaced braces in strncmp call Bruce Richardson
[not found] ` <1416387973-28431-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-19 10:20 ` Olivier MATZ
[not found] ` <546C6EF3.1080507-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-11-24 15:54 ` Thomas Monjalon
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.