public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Long, Qin" <qin.long@intel.com>
To: Gary Lin <glin@suse.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>
Subject: Re: [PATCH] CryptoPkg/IntrinsicLib: Fix the warning on memset
Date: Wed, 22 Nov 2017 08:10:37 +0000	[thread overview]
Message-ID: <BF2CCE9263284D428840004653A28B6E54026CC6@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20171122044356.10258-1-glin@suse.com>

Reviewed-by: Long Qin <qin.long@intel.com>

(Thanks, Gary. 
I cannot recall why we used "char" instead of "int" here. Obviously, the prototype of CRT memset should use "int").


Best Regards & Thanks,
LONG, Qin

-----Original Message-----
From: Gary Lin [mailto:glin@suse.com] 
Sent: Wednesday, November 22, 2017 12:44 PM
To: edk2-devel@lists.01.org
Cc: Long, Qin <qin.long@intel.com>; Ye, Ting <ting.ye@intel.com>
Subject: [PATCH] CryptoPkg/IntrinsicLib: Fix the warning on memset

Gcc issued the warning when compiling CryptoPkg:

CryptoPkg/Library/Include/CrtLibSupport.h:135:17: warning: type of 'memset' does not match original declaration [-Wlto-type-mismatch]
 void           *memset     (void *, int, size_t);
                 ^
CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c:27:8: note: type mismatch in parameter 2  void * memset (void *dest, char ch, size_t count)
        ^

This commit changes the type of ch from char to int to match the declaration.

Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin <glin@suse.com>
---
 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
index bf485d680d..e095f9aa0d 100644
--- a/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
+++ b/CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
@@ -24,7 +24,7 @@ typedef UINTN  size_t;  int _fltused = 1;
 
 /* Sets buffers to a specified character */ -void * memset (void *dest, char ch, size_t count)
+void * memset (void *dest, int ch, size_t count)
 {
   //
   // NOTE: Here we use one base implementation for memset, instead of the direct @@ -42,7 +42,7 @@ void * memset (void *dest, char ch, size_t count)
 
   Pointer = (UINT8 *)dest;
   while (count-- != 0) {
-    *(Pointer++) = ch;
+    *(Pointer++) = (UINT8)ch;
   }
   
   return dest;
--
2.15.0



      reply	other threads:[~2017-11-22  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  4:43 [PATCH] CryptoPkg/IntrinsicLib: Fix the warning on memset Gary Lin
2017-11-22  8:10 ` Long, Qin [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-list 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=BF2CCE9263284D428840004653A28B6E54026CC6@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /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