Revision b09757104e433447226a95eff4b92583acc0b0fb authored by Peter Rosin on 16 July 2019, 23:27:15 UTC, committed by Linus Torvalds on 17 July 2019, 02:23:22 UTC
Patch series "lib/string: search for NUL with strchr/strnchr".

I noticed an inconsistency where strchr and strnchr do not behave the
same with respect to the trailing NUL.  strchr is standardised and the
kernel function conforms, and the kernel relies on the behavior.  So,
naturally strchr stays as-is and strnchr is what I change.

While writing a few tests to verify that my new strnchr loop was sane, I
noticed that the tests for memset16/32/64 had a problem.  Since it's all
about the lib/string.c file I made a short series of it all...

This patch (of 3):

strchr considers the terminating NUL to be part of the string, and NUL
can thus be searched for with that function.  For consistency, do the
same with strnchr.

Link: http://lkml.kernel.org/r/20190506124634.6807-2-peda@axentia.se
Signed-off-by: Peter Rosin <peda@axentia.se>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4c6080c
History
File Mode Size
kasan
Kconfig -rw-r--r-- 24.3 KB
Kconfig.debug -rw-r--r-- 4.6 KB
Makefile -rw-r--r-- 3.7 KB
backing-dev.c -rw-r--r-- 26.8 KB
balloon_compaction.c -rw-r--r-- 7.8 KB
cleancache.c -rw-r--r-- 9.8 KB
cma.c -rw-r--r-- 14.3 KB
cma.h -rw-r--r-- 573 bytes
cma_debug.c -rw-r--r-- 4.5 KB
compaction.c -rw-r--r-- 75.0 KB
debug.c -rw-r--r-- 5.9 KB
debug_page_ref.c -rw-r--r-- 1.4 KB
dmapool.c -rw-r--r-- 13.8 KB
early_ioremap.c -rw-r--r-- 6.8 KB
fadvise.c -rw-r--r-- 5.3 KB
failslab.c -rw-r--r-- 1.4 KB
filemap.c -rw-r--r-- 96.5 KB
frame_vector.c -rw-r--r-- 6.4 KB
frontswap.c -rw-r--r-- 14.2 KB
gup.c -rw-r--r-- 65.9 KB
gup_benchmark.c -rw-r--r-- 2.7 KB
highmem.c -rw-r--r-- 11.7 KB
hmm.c -rw-r--r-- 34.4 KB
huge_memory.c -rw-r--r-- 82.7 KB
hugetlb.c -rw-r--r-- 135.4 KB
hugetlb_cgroup.c -rw-r--r-- 10.9 KB
hwpoison-inject.c -rw-r--r-- 2.8 KB
init-mm.c -rw-r--r-- 1.2 KB
internal.h -rw-r--r-- 17.1 KB
interval_tree.c -rw-r--r-- 3.1 KB
khugepaged.c -rw-r--r-- 48.2 KB
kmemleak-test.c -rw-r--r-- 2.6 KB
kmemleak.c -rw-r--r-- 59.5 KB
ksm.c -rw-r--r-- 89.5 KB
list_lru.c -rw-r--r-- 14.6 KB
maccess.c -rw-r--r-- 3.1 KB
madvise.c -rw-r--r-- 23.0 KB
memblock.c -rw-r--r-- 56.5 KB
memcontrol.c -rw-r--r-- 174.7 KB
memfd.c -rw-r--r-- 7.8 KB
memory-failure.c -rw-r--r-- 51.8 KB
memory.c -rw-r--r-- 125.9 KB
memory_hotplug.c -rw-r--r-- 48.6 KB
mempolicy.c -rw-r--r-- 72.4 KB
mempool.c -rw-r--r-- 15.8 KB
memtest.c -rw-r--r-- 2.8 KB
migrate.c -rw-r--r-- 76.2 KB
mincore.c -rw-r--r-- 7.5 KB
mlock.c -rw-r--r-- 22.7 KB
mm_init.c -rw-r--r-- 4.8 KB
mmap.c -rw-r--r-- 100.2 KB
mmu_context.c -rw-r--r-- 1.3 KB
mmu_gather.c -rw-r--r-- 6.8 KB
mmu_notifier.c -rw-r--r-- 11.8 KB
mmzone.c -rw-r--r-- 2.4 KB
mprotect.c -rw-r--r-- 15.6 KB
mremap.c -rw-r--r-- 19.4 KB
msync.c -rw-r--r-- 2.6 KB
nommu.c -rw-r--r-- 45.5 KB
oom_kill.c -rw-r--r-- 30.0 KB
page-writeback.c -rw-r--r-- 84.7 KB
page_alloc.c -rw-r--r-- 236.7 KB
page_counter.c -rw-r--r-- 6.6 KB
page_ext.c -rw-r--r-- 11.0 KB
page_idle.c -rw-r--r-- 5.5 KB
page_io.c -rw-r--r-- 10.5 KB
page_isolation.c -rw-r--r-- 9.2 KB
page_owner.c -rw-r--r-- 14.7 KB
page_poison.c -rw-r--r-- 3.0 KB
page_vma_mapped.c -rw-r--r-- 7.6 KB
pagewalk.c -rw-r--r-- 8.7 KB
percpu-internal.h -rw-r--r-- 6.3 KB
percpu-km.c -rw-r--r-- 3.0 KB
percpu-stats.c -rw-r--r-- 5.7 KB
percpu-vm.c -rw-r--r-- 10.3 KB
percpu.c -rw-r--r-- 92.4 KB
pgtable-generic.c -rw-r--r-- 5.3 KB
process_vm_access.c -rw-r--r-- 9.8 KB
quicklist.c -rw-r--r-- 2.4 KB
readahead.c -rw-r--r-- 16.5 KB
rmap.c -rw-r--r-- 53.7 KB
rodata_test.c -rw-r--r-- 1.3 KB
shmem.c -rw-r--r-- 105.0 KB
shuffle.c -rw-r--r-- 5.7 KB
shuffle.h -rw-r--r-- 1.5 KB
slab.c -rw-r--r-- 105.4 KB
slab.h -rw-r--r-- 17.3 KB
slab_common.c -rw-r--r-- 43.0 KB
slob.c -rw-r--r-- 17.0 KB
slub.c -rw-r--r-- 143.2 KB
sparse-vmemmap.c -rw-r--r-- 6.6 KB
sparse.c -rw-r--r-- 21.5 KB
swap.c -rw-r--r-- 28.7 KB
swap_cgroup.c -rw-r--r-- 5.2 KB
swap_slots.c -rw-r--r-- 9.4 KB
swap_state.c -rw-r--r-- 22.4 KB
swapfile.c -rw-r--r-- 94.7 KB
truncate.c -rw-r--r-- 26.4 KB
usercopy.c -rw-r--r-- 9.3 KB
userfaultfd.c -rw-r--r-- 15.8 KB
util.c -rw-r--r-- 17.1 KB
vmacache.c -rw-r--r-- 2.7 KB
vmalloc.c -rw-r--r-- 88.3 KB
vmpressure.c -rw-r--r-- 13.8 KB
vmscan.c -rw-r--r-- 122.8 KB
vmstat.c -rw-r--r-- 51.5 KB
workingset.c -rw-r--r-- 19.2 KB
z3fold.c -rw-r--r-- 39.7 KB
zbud.c -rw-r--r-- 18.2 KB
zpool.c -rw-r--r-- 10.7 KB
zsmalloc.c -rw-r--r-- 60.0 KB
zswap.c -rw-r--r-- 34.2 KB

back to top