linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: tests: Fix endian issue with CRC generation algorithm
@ 2014-04-17  5:09 Paul McGougan
  0 siblings, 0 replies; only message in thread
From: Paul McGougan @ 2014-04-17  5:09 UTC (permalink / raw)
  To: linux-mtd

The calculation of the CRC in /tests/checkfs/makefiles.c was writing the CRC
Into the produced files in host byte-order which would cause CRC validation
to fail on big-endian systems as the validation is performed bytewise.

Signed-off-by: Paul McGougan <pmcgougan AT topcon.com>
---
tests/checkfs/makefiles.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/checkfs/makefiles.c b/tests/checkfs/makefiles.c
index 662fe86..050ea60 100644
--- a/tests/checkfs/makefiles.c
+++ b/tests/checkfs/makefiles.c
@@ -170,6 +170,7 @@ void checksum(char *filename){
     printf("Error! Cannot open filename to update checksum: %s\n",filename);
     exit(1);
   }
+  crc = htole16(crc);
   if(fwrite(&crc, sizeof(crc), 1, fp) != 1){
     printf("error! unable to update the file for checksum.\n");
     fclose(fp);


Confidentiality Notice:  This message (including attachments) is a private communication solely for use of the intended recipient(s).  
If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this 
message.  Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic 
Communication Privacy Act of 1986."

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-17  5:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17  5:09 [PATCH] mtd: tests: Fix endian issue with CRC generation algorithm Paul McGougan

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