+ lib-test_string-avoid-masking-memset16-32-64-failures.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: lib/test_string.c: avoid masking memset16/32/64 failures
has been added to the -mm tree.  Its filename is
     lib-test_string-avoid-masking-memset16-32-64-failures.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/lib-test_string-avoid-masking-memset16-32-64-failures.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/lib-test_string-avoid-masking-memset16-32-64-failures.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Peter Rosin <peda@xxxxxxxxxx>
Subject: lib/test_string.c: avoid masking memset16/32/64 failures

If a memsetXX implementation is completely broken and fails in the first
iteration, when i, j, and k are all zero, the failure is masked as zero is
returned.  Failing in the first iteration is perhaps the most likely
failure, so this makes the tests pretty much useless.  Avoid the situation
by always setting a random unused bit in the result on failure.

Link: http://lkml.kernel.org/r/20190506124634.6807-3-peda@xxxxxxxxxx
Fixes: 03270c13c5ff ("lib/string.c: add testcases for memset16/32/64")
Signed-off-by: Peter Rosin <peda@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/test_string.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/lib/test_string.c~lib-test_string-avoid-masking-memset16-32-64-failures
+++ a/lib/test_string.c
@@ -35,7 +35,7 @@ static __init int memset16_selftest(void
 fail:
 	kfree(p);
 	if (i < 256)
-		return (i << 24) | (j << 16) | k;
+		return (i << 24) | (j << 16) | k | 0x8000;
 	return 0;
 }
 
@@ -71,7 +71,7 @@ static __init int memset32_selftest(void
 fail:
 	kfree(p);
 	if (i < 256)
-		return (i << 24) | (j << 16) | k;
+		return (i << 24) | (j << 16) | k | 0x8000;
 	return 0;
 }
 
@@ -107,7 +107,7 @@ static __init int memset64_selftest(void
 fail:
 	kfree(p);
 	if (i < 256)
-		return (i << 24) | (j << 16) | k;
+		return (i << 24) | (j << 16) | k | 0x8000;
 	return 0;
 }
 
_

Patches currently in -mm which might be from peda@xxxxxxxxxx are

lib-string-allow-searching-for-nul-with-strnchr.patch
lib-test_string-avoid-masking-memset16-32-64-failures.patch
lib-test_string-add-some-testcases-for-strchr-and-strnchr.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux