Skip to content

Commit ed1b409

Browse files
committed
Merge tag 'hardening-v6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening updates from Kees Cook: - string: Add missing kernel-doc return descriptions (Kriish Sharma) - Update some mis-typed allocations These correct some accidentally wrong types used in allocations (that didn't affect the resulting size) that never got picked up from the batch I sent a few months ago. - Enable GCC diagnostic context for value-tracking warnings This results in better GCC diagnostics for the value range tracking, so we can get better visibility into where those values are coming from when we get out-of-bounds warnings at compile time. * tag 'hardening-v6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: kbuild: Enable GCC diagnostic context for value-tracking warnings string: Add missing kernel-doc return descriptions media: iris: Cast iris_hfi_gen2_get_instance() allocation type drm/plane: Remove const qualifier from plane->modifiers allocation type comedi: Adjust range_table_list allocation type
2 parents 3ee37ab + 7454048 commit ed1b409

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,9 @@ KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
940940
# for the randomize_kstack_offset feature. Disable it for all compilers.
941941
KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
942942

943+
# Get details on warnings generated due to GCC value tracking.
944+
KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
945+
943946
# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
944947
ifdef CONFIG_ZERO_CALL_USED_REGS
945948
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr

drivers/comedi/drivers/ni_670x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int ni_670x_auto_attach(struct comedi_device *dev,
199199
const struct comedi_lrange **range_table_list;
200200

201201
range_table_list = kmalloc_array(32,
202-
sizeof(struct comedi_lrange *),
202+
sizeof(*range_table_list),
203203
GFP_KERNEL);
204204
if (!range_table_list)
205205
return -ENOMEM;

drivers/gpu/drm/drm_plane.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
425425

426426
plane->modifier_count = format_modifier_count;
427427
plane->modifiers = kmalloc_array(format_modifier_count,
428-
sizeof(format_modifiers[0]),
428+
sizeof(*plane->modifiers),
429429
GFP_KERNEL);
430430

431431
if (format_modifier_count && !plane->modifiers) {

drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,5 +1212,5 @@ void iris_hfi_gen2_command_ops_init(struct iris_core *core)
12121212

12131213
struct iris_inst *iris_hfi_gen2_get_instance(void)
12141214
{
1215-
return kzalloc(sizeof(struct iris_inst_hfi_gen2), GFP_KERNEL);
1215+
return (struct iris_inst *)kzalloc(sizeof(struct iris_inst_hfi_gen2), GFP_KERNEL);
12161216
}

include/linux/string.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ static inline void memzero_explicit(void *s, size_t count)
371371
* kbasename - return the last part of a pathname.
372372
*
373373
* @path: path to extract the filename from.
374+
*
375+
* Returns:
376+
* Pointer to the filename portion inside @path. If no '/' exists,
377+
* returns @path unchanged.
374378
*/
375379
static inline const char *kbasename(const char *path)
376380
{
@@ -556,6 +560,9 @@ static __always_inline size_t str_has_prefix(const char *str, const char *prefix
556560
* strstarts - does @str start with @prefix?
557561
* @str: string to examine
558562
* @prefix: prefix to look for.
563+
*
564+
* Returns:
565+
* True if @str begins with @prefix. False in all other cases.
559566
*/
560567
static inline bool strstarts(const char *str, const char *prefix)
561568
{

0 commit comments

Comments
 (0)