dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH] test: fix misplaced braces in strncmp call
Date: Wed, 19 Nov 2014 09:06:13 +0000	[thread overview]
Message-ID: <1416387973-28431-1-git-send-email-bruce.richardson@intel.com> (raw)

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

             reply	other threads:[~2014-11-19  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19  9:06 Bruce Richardson [this message]
     [not found] ` <1416387973-28431-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-19 10:20   ` [PATCH] test: fix misplaced braces in strncmp call Olivier MATZ
     [not found]     ` <546C6EF3.1080507-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-11-24 15:54       ` Thomas Monjalon

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=1416387973-28431-1-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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;
as well as URLs for NNTP newsgroup(s).