]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
lib/test_string.c: avoid masking memset16/32/64 failures
authorPeter Rosin <peda@axentia.se>
Tue, 16 Jul 2019 23:27:18 +0000 (16:27 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit29a0183b2fcd3694985ad3d92d385d20673f0acb
treea1a01a79da9a520d13a439258db030b76ca4d724
parentc9ff838b18dc002ce3cf9931e07d3fbc354634d0
lib/test_string.c: avoid masking memset16/32/64 failures

BugLink: https://bugs.launchpad.net/bugs/1839376
[ Upstream commit 33d6e0ff68af74be0c846c8e042e84a9a1a0561e ]

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@axentia.se
Fixes: 03270c13c5ff ("lib/string.c: add testcases for memset16/32/64")
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
lib/test_string.c