public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/4] staging: keucr: Use strncmp() instead of custom
Date: Fri, 31 Dec 2010 10:09:52 +0000	[thread overview]
Message-ID: <20101231100952.GD1886@bicker> (raw)
In-Reply-To: <1293787164-7056-2-git-send-email-martinez.javier@gmail.com>

On Fri, Dec 31, 2010 at 10:19:21AM +0100, Javier Martinez Canillas wrote:
>  //----- Check_D_CISdata() ----------------------------------------------
>  int Check_D_CISdata(BYTE *buf, BYTE *redundant)
>  {
> -    BYTE cis[]={0x01,0x03,0xD9,0x01,0xFF,0x18,0x02,0xDF,0x01,0x20};
> +	BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
> +		      0xDF, 0x01, 0x20};
>  
> -    if (!IsSSFDCCompliance && !IsXDCompliance)
> -        return(SUCCESS);             // 目前為強制 SUCCESS [Arnold 02-08-23] SSFDC 測試, 不能強制 SUCCESS
> +	if (!IsSSFDCCompliance && !IsXDCompliance)
> +		return SUCCESS;
>  
> -    if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
> -        return(StringCmp((char *)buf,(char *)cis,10));
> +	if (!strncmp((char *)(redundant+0x0D), (char *)EccBuf, 3))
> +		return strncmp((char *)buf, (char *)cis, 10);


"cis" isn't a string.  I suspect none of these are.  Use memcmp()
instead of strncmp().  With memcmp() you can get rid of the cast.  Also
use sizeof(cis) instead of hardcoding it to 10.

Eventually we should also put all the 0x0D magic variables in defines as
well.

regards,
dan carpenter

--
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

      reply	other threads:[~2010-12-31 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-31  9:19 [PATCH 1/4] staging: keucr: Use strncmp() instead of custom StringCmp() and some style cleanups Javier Martinez Canillas
2010-12-31 10:09 ` Dan Carpenter [this message]

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=20101231100952.GD1886@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.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