android_kernel_sony_sdm845/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Arnd Bergmann b9dd13488a exec: avoid gcc-8 warning for get_task_comm
commit 3756f6401c302617c5e091081ca4d26ab604bec5 upstream.

gcc-8 warns about using strncpy() with the source size as the limit:

  fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]

This is indeed slightly suspicious, as it protects us from source
arguments without NUL-termination, but does not guarantee that the
destination is terminated.

This keeps the strncpy() to ensure we have properly padded target
buffer, but ensures that we use the correct length, by passing the
actual length of the destination buffer as well as adding a build-time
check to ensure it is exactly TASK_COMM_LEN.

There are only 23 callsites which I all reviewed to ensure this is
currently the case.  We could get away with doing only the check or
passing the right length, but it doesn't hurt to do both.

Link: http://lkml.kernel.org/r/20171205151724.1764896-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Kees Cook <keescook@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Aleksa Sarai <asarai@suse.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-28 07:49:14 +02:00
..
acpi ACPICA: OSL: Add support to exclude stdarg.h 2018-04-13 19:48:28 +02:00
asm-generic asm-generic: provide generic_pmdp_establish() 2018-05-30 07:50:23 +02:00
clocksource
crypto crypto: hash - prevent using keyed hashes without setting key 2018-02-25 11:05:44 +01:00
drm drm: Allow determining if current task is output poll worker 2018-03-18 11:18:48 +01:00
dt-bindings dt-bindings: clock: mediatek: add binding for fixed-factor clock axisel_d4 2018-04-24 09:34:14 +02:00
keys
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux exec: avoid gcc-8 warning for get_task_comm 2018-07-28 07:49:14 +02:00
math-emu
media Linux 4.8 2016-10-05 16:43:53 -03:00
memory
misc
net tcp: do not delay ACK in DCTCP upon CE status change 2018-07-28 07:49:12 +02:00
pcmcia
ras
rdma RDMA/ucma: Introduce safer rdma_addr_size() variants 2018-04-08 12:12:49 +02:00
rxrpc rxrpc: Add tracepoint for ACK proposal 2016-09-23 15:49:19 +01:00
scsi scsi: sg: disable SET_FORCE_LOW_DMA 2018-01-23 19:57:04 +01:00
soc fsl/qe: add bit description for SYNL register for GUMR 2018-04-13 19:48:01 +02:00
sound ALSA: control: Hardening for potential Spectre v1 2018-05-01 15:13:06 -07:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:38:54 +01:00
trace tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account 2018-05-30 07:50:19 +02:00
uapi btrfs: define SUPER_FLAG_METADUMP_V2 2018-06-13 16:16:41 +02:00
video fbdev changes for 4.9 2016-10-12 11:01:37 -07:00
xen swiotlb-xen: implement xen_swiotlb_dma_mmap callback 2017-10-05 09:44:05 +02:00
Kbuild