android_kernel_motorola_sm6225/lib
Mirsad Goran Todorovac d24ccc6bca test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation
commit 7dae593cd226a0bca61201cf85ceb9335cf63682 upstream.

In a couple of situations like

	name = kstrndup(buf, count, GFP_KERNEL);
	if (!name)
		return -ENOSPC;

the error is not actually "No space left on device", but "Out of memory".

It is semantically correct to return -ENOMEM in all failed kstrndup()
and kzalloc() cases in this driver, as it is not a problem with disk
space, but with kernel memory allocator failing allocation.

The semantically correct should be:

        name = kstrndup(buf, count, GFP_KERNEL);
        if (!name)
                return -ENOMEM;

Cc: Dan Carpenter <error27@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Luis R. Rodriguez" <mcgrof@ruslug.rutgers.edu>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>
Fixes: c92316bf8e ("test_firmware: add batched firmware tests")
Fixes: 0a8adf5847 ("test: add firmware_class loader test")
Fixes: 548193cba2a7d ("test_firmware: add support for firmware_request_platform")
Fixes: eb910947c8 ("test: firmware_class: add asynchronous request trigger")
Fixes: 061132d2b9 ("test_firmware: add test custom fallback trigger")
Fixes: 7feebfa487b92 ("test_firmware: add support for request_firmware_into_buf")
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Message-ID: <20230606070808.9300-1-mirsad.todorovac@alu.unizg.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-11 11:45:39 +02:00
..
842
crypto lib/crypto: blake2s: move hmac construction into wireguard 2022-06-25 11:48:58 +02:00
fonts Fonts: Replace discarded const qualifier 2020-11-10 12:35:57 +01:00
lz4
lzo
mpi lib/mpi: Fix buffer overrun when SG is too long 2023-03-11 16:31:35 +01:00
raid6 lib/raid6/test/Makefile: Use $(pound) instead of \# for Make 4.3 2022-04-15 14:14:54 +02:00
reed_solomon rslib: Fix handling of of caller provided syndrome 2019-07-26 09:14:12 +02:00
xz lib/xz: Validate the value before assigning it to an enum variable 2021-11-26 11:36:06 +01:00
zlib_deflate
zlib_inflate lib/zlib: remove outdated and incorrect pre-increment optimization 2020-06-25 15:33:02 +02:00
zstd
.gitignore lib: add crc64 calculation routines 2018-08-22 10:52:48 -07:00
argv_split.c
ashldi3.c
ashrdi3.c
asn1_decoder.c
assoc_array.c assoc_array: Fix BUG_ON during garbage collect 2022-06-06 08:24:20 +02:00
atomic64.c
atomic64_test.c
audit.c
bcd.c
bch.c lib/bch: fix possible stack overrun 2018-10-12 09:17:46 +02:00
bitmap.c lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf 2019-12-01 09:17:08 +01:00
bitrev.c
bsearch.c kprobes: Prohibit probing on bsearch() 2019-04-05 22:33:08 +02:00
btree.c
bucket_locks.c ila: make lockdep happy again 2018-08-16 12:14:42 -07:00
bug.c bug: Remove redundant condition check in report_bug 2021-05-22 10:59:35 +02:00
build_OID_registry
bust_spinlocks.c
chacha20.c crypto: chacha20 - Fix chacha20_block() keystream alignment (again) 2019-11-20 18:47:11 +01:00
check_signature.c
checksum.c
clz_ctz.c
clz_tab.c
cmdline.c
cmpdi2.c
compat_audit.c
cordic.c
cpu_rmap.c lib: cpu_rmap: Fix potential use-after-free in irq_cpu_rmap_release() 2023-06-14 10:57:13 +02:00
cpumask.c
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c
crc4.c
crc7.c
crc8.c
crc16.c
crc32.c lib/crc32.c: fix trivial typo in preprocessor condition 2020-10-30 10:38:21 +01:00
crc32defs.h
crc32test.c lib/crc32test: remove extra local_irq_disable/enable 2020-11-10 12:35:57 +01:00
crc64.c lib: add crc64 calculation routines 2018-08-22 10:52:48 -07:00
ctype.c
debug_info.c
debug_locks.c locking/lockdep: Fix debug_locks off performance problem 2018-11-13 11:08:20 -08:00
debugobjects.c debugobjects: Recheck debug_objects_enabled before reporting 2023-08-11 11:45:24 +02:00
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlz4.c lib/decompress_unlz4.c: correctly handle zero-padding around initrds. 2021-07-20 16:16:10 +02:00
decompress_unlzma.c
decompress_unlzo.c
decompress_unxz.c lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompression 2021-11-26 11:36:06 +01:00
devres.c lib: devres: add a helper function for ioremap_uc 2020-05-10 10:30:11 +02:00
digsig.c
div64.c lib/div64.c: off by one in shift 2019-04-20 09:16:05 +02:00
dump_stack.c dump_stack: avoid the livelock of the dump_lock 2019-11-12 19:20:37 +01:00
dynamic_debug.c lib/dynamic_debug.c: use address-of operator on section symbols 2023-06-09 10:24:02 +02:00
dynamic_queue_limits.c
earlycpio.c
error-inject.c
errseq.c
extable.c
fault-inject.c
fdt.c
fdt_empty_tree.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_wip.c
find_bit.c uapi: rename ext2_swab() to swab() and share globally in swab.h 2020-04-17 10:48:43 +02:00
find_bit_benchmark.c
flex_array.c
flex_proportions.c
gcd.c
gen_crc32table.c
gen_crc64table.c lib: add crc64 calculation routines 2018-08-22 10:52:48 -07:00
genalloc.c lib/genalloc: fix the overflow when size is too big 2021-01-12 20:10:16 +01:00
glob.c
globtest.c
hexdump.c hex2bin: fix access beyond string end 2022-05-12 12:20:20 +02:00
hweight.c
idr.c ida: don't use BUG_ON() for debugging 2022-07-12 16:29:03 +02:00
inflate.c
int_sqrt.c fix int_sqrt64() for very large numbers 2019-01-22 21:40:34 +01:00
interval_tree.c
interval_tree_test.c
iomap.c
iomap_copy.c
iommu-helper.c
ioremap.c
iov_iter.c lib/iov_iter: initialize "flags" in new pipe_buffer 2022-02-23 11:58:41 +01:00
irq_poll.c
irq_regs.c
is_single_threaded.c
jedec_ddr_data.c
kasprintf.c
Kconfig ARM: 9178/1: fix unmet dependency on BITREVERSE for HAVE_ARCH_BITREVERSE 2022-03-23 09:10:41 +01:00
Kconfig.debug Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled 2022-12-08 11:18:34 +01:00
Kconfig.kasan
Kconfig.kgdb
Kconfig.ubsan
kfifo.c Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()" 2020-01-27 14:51:08 +01:00
klist.c
kobject.c Driver core patches for 4.19-rc1 2018-08-18 11:44:53 -07:00
kobject_uevent.c kobject_uevent: remove warning in init_uevent_argv() 2021-05-22 10:59:47 +02:00
kstrtox.c lib: vsprintf: Fix handling of number field widths in vsscanf 2021-07-20 16:15:45 +02:00
kstrtox.h lib: vsprintf: Fix handling of number field widths in vsscanf 2021-07-20 16:15:45 +02:00
lcm.c
libcrc32c.c
list_debug.c lib/list_debug.c: Detect uninitialized lists 2022-08-25 11:15:45 +02:00
list_sort.c
llist.c
locking-selftest-hardirq.h
locking-selftest-mutex.h
locking-selftest-rlock-hardirq.h
locking-selftest-rlock-softirq.h
locking-selftest-rlock.h
locking-selftest-rsem.h
locking-selftest-rtmutex.h
locking-selftest-softirq.h
locking-selftest-spin-hardirq.h
locking-selftest-spin-softirq.h
locking-selftest-spin.h
locking-selftest-wlock-hardirq.h
locking-selftest-wlock-softirq.h
locking-selftest-wlock.h
locking-selftest-wsem.h
locking-selftest.c
lockref.c
logic_pio.c PCI: Fix pci_register_io_range() memory leak 2021-03-17 16:43:46 +01:00
lru_cache.c
lshrdi3.c
Makefile crypto: blake2s - generic C library implementation and selftest 2022-06-25 11:48:58 +02:00
memory-notifier-error-inject.c
memweight.c
muldi3.c
net_utils.c
netdev-notifier-error-inject.c
nlattr.c net: fix nla_strcmp to handle more then one trailing null character 2021-05-22 10:59:44 +02:00
nmi_backtrace.c
nodemask.c nodemask: Fix return values to be unsigned 2022-06-14 16:59:38 +02:00
notifier-error-inject.c lib/notifier-error-inject: fix error when writing -errno to debugfs file 2023-01-18 11:30:06 +01:00
notifier-error-inject.h
of-reconfig-notifier-error-inject.c
oid_registry.c
once.c once: add DO_ONCE_SLOW() for sleepable contexts 2022-10-26 13:19:26 +02:00
parman.c
parser.c
pci_iomap.c
percpu-refcount.c
percpu_counter.c notifier: Remove notifier header file wherever not used 2018-08-30 12:56:40 +02:00
percpu_test.c
plist.c
pm-notifier-error-inject.c
prime_numbers.c
radix-tree.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
random32.c random: replace custom notifier chain with standard one 2022-06-25 11:49:08 +02:00
ratelimit.c ratelimit: Fix data-races in ___ratelimit(). 2022-09-05 10:26:30 +02:00
rational.c
rbtree.c
rbtree_test.c
reciprocal_div.c
refcount.c
rhashtable.c rhashtable: Still do rehash when we get EEXIST 2019-04-03 06:26:17 +02:00
sbitmap.c sbitmap: fix improper use of smp_mb__before_atomic() 2019-05-31 06:46:00 -07:00
scatterlist.c sgl_alloc_order: fix memory leak 2020-11-05 11:08:45 +01:00
seq_buf.c seq_buf: Fix overflow in seq_buf_putmem_hex() 2021-07-20 16:16:05 +02:00
sg_pool.c
sg_split.c
sha1.c lib/crypto: sha1: re-roll loops to reduce code size 2022-06-25 11:48:58 +02:00
sha256.c
show_mem.c
siphash.c siphash: use one source of truth for siphash permutations 2022-06-25 11:49:11 +02:00
smp_processor_id.c
sort.c
stackdepot.c lib: stackdepot: turn depot_lock spinlock to raw_spinlock 2021-05-22 10:59:49 +02:00
stmp_device.c
string.c lib/string: Add strscpy_pad() function 2021-02-13 13:51:15 +01:00
string_helpers.c
strncpy_from_user.c lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() 2020-06-22 09:04:59 +02:00
strnlen_user.c lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() 2020-06-22 09:04:59 +02:00
syscall.c
test-kstrtox.c
test-string_helpers.c
test_bitfield.c
test_bitmap.c
test_bpf.c bpf/tests: Do not PASS tests without actually testing the result 2021-09-22 11:48:04 +02:00
test_debug_virtual.c lib: fix build failure in CONFIG_DEBUG_VIRTUAL test 2019-01-13 09:51:10 +01:00
test_firmware.c test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation 2023-08-11 11:45:39 +02:00
test_hash.c
test_hexdump.c test_hexdump: use memcpy instead of strncpy 2018-12-08 12:59:06 +01:00
test_ida.c test_ida: Fix lockdep warning 2018-10-15 16:31:29 -04:00
test_kasan.c lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() 2020-02-11 04:33:57 -08:00
test_kmod.c lib/test: use after free in register_test_dev_kmod() 2022-04-15 14:14:53 +02:00
test_list_sort.c
test_module.c
test_overflow.c lib/test_overflow.c: avoid tainting the kernel and fix wrap size 2019-08-06 19:06:51 +02:00
test_parman.c
test_printf.c
test_rhashtable.c lib/test_rhashtable: Make test_insert_dup() allocate its hash table dynamically 2019-02-12 19:47:21 +01:00
test_siphash.c
test_sort.c
test_static_key_base.c
test_static_keys.c
test_string.c lib/test_string.c: avoid masking memset16/32/64 failures 2019-08-06 19:06:51 +02:00
test_sysctl.c
test_ubsan.c
test_user_copy.c
test_uuid.c
textsearch.c lib: textsearch: fix escapes in example code 2019-10-29 09:19:35 +01:00
timerqueue.c lib/timerqueue: Rely on rbtree semantics for next timer 2021-10-09 14:11:04 +02:00
ts_bm.c lib/ts_bm: reset initial match offset for every block of text 2023-08-11 11:45:07 +02:00
ts_fsm.c
ts_kmp.c
ubsan.c ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings 2019-05-10 17:54:04 +02:00
ubsan.h
ucmpdi2.c
ucs2_string.c
usercopy.c uaccess: Add speculation barrier to copy_from_user() 2023-02-25 11:51:51 +01:00
uuid.c
vsprintf.c random: replace custom notifier chain with standard one 2022-06-25 11:49:08 +02:00
win_minmax.c
xxhash.c