Skip to content

Commit 7900504

Browse files
committed
Merge branch 'for-next/kspp' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
2 parents 1a8102b + 8e05132 commit 7900504

File tree

6 files changed

+24
-9
lines changed

6 files changed

+24
-9
lines changed

drivers/soc/tegra/fuse/fuse-tegra.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info)
127127

128128
static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
129129
{
130-
fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
131-
fuse->soc->num_lookups, GFP_KERNEL);
130+
fuse->lookups = kmemdup_array(fuse->soc->lookups, fuse->soc->num_lookups,
131+
sizeof(*fuse->lookups), GFP_KERNEL);
132132
if (!fuse->lookups)
133133
return -ENOMEM;
134134

include/linux/string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ extern void *kmemdup_noprof(const void *src, size_t len, gfp_t gfp) __realloc_si
289289

290290
extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
291291
extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
292-
extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp)
292+
extern void *kmemdup_array(const void *src, size_t count, size_t element_size, gfp_t gfp)
293293
__realloc_size(2, 3);
294294

295295
/* lib/argv_split.c */

lib/fortify_kunit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static const char * const test_strs[] = {
372372
for (i = 0; i < ARRAY_SIZE(test_strs); i++) { \
373373
len = strlen(test_strs[i]); \
374374
KUNIT_EXPECT_EQ(test, __builtin_constant_p(len), 0); \
375-
checker(len, kmemdup_array(test_strs[i], len, 1, gfp), \
375+
checker(len, kmemdup_array(test_strs[i], 1, len, gfp), \
376376
kfree(p)); \
377377
checker(len, kmemdup(test_strs[i], len, gfp), \
378378
kfree(p)); \

lib/overflow_kunit.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,14 +1178,28 @@ struct foo {
11781178
s16 array[] __counted_by(counter);
11791179
};
11801180

1181+
struct bar {
1182+
int a;
1183+
u32 counter;
1184+
s16 array[];
1185+
};
1186+
11811187
static void DEFINE_FLEX_test(struct kunit *test)
11821188
{
1183-
DEFINE_RAW_FLEX(struct foo, two, array, 2);
1189+
/* Using _RAW_ on a __counted_by struct will initialize "counter" to zero */
1190+
DEFINE_RAW_FLEX(struct foo, two_but_zero, array, 2);
1191+
#if __has_attribute(__counted_by__)
1192+
int expected_raw_size = sizeof(struct foo);
1193+
#else
1194+
int expected_raw_size = sizeof(struct foo) + 2 * sizeof(s16);
1195+
#endif
1196+
/* Without annotation, it will always be on-stack size. */
1197+
DEFINE_RAW_FLEX(struct bar, two, array, 2);
11841198
DEFINE_FLEX(struct foo, eight, array, counter, 8);
11851199
DEFINE_FLEX(struct foo, empty, array, counter, 0);
11861200

1187-
KUNIT_EXPECT_EQ(test, __struct_size(two),
1188-
sizeof(struct foo) + sizeof(s16) + sizeof(s16));
1201+
KUNIT_EXPECT_EQ(test, __struct_size(two_but_zero), expected_raw_size);
1202+
KUNIT_EXPECT_EQ(test, __struct_size(two), sizeof(struct bar) + 2 * sizeof(s16));
11891203
KUNIT_EXPECT_EQ(test, __struct_size(eight), 24);
11901204
KUNIT_EXPECT_EQ(test, __struct_size(empty), sizeof(struct foo));
11911205
}

mm/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ EXPORT_SYMBOL(kmemdup_noprof);
139139
* kmemdup_array - duplicate a given array.
140140
*
141141
* @src: array to duplicate.
142-
* @element_size: size of each element of array.
143142
* @count: number of elements to duplicate from array.
143+
* @element_size: size of each element of array.
144144
* @gfp: GFP mask to use.
145145
*
146146
* Return: duplicated array of @src or %NULL in case of error,
147147
* result is physically contiguous. Use kfree() to free.
148148
*/
149-
void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp)
149+
void *kmemdup_array(const void *src, size_t count, size_t element_size, gfp_t gfp)
150150
{
151151
return kmemdup(src, size_mul(element_size, count), gfp);
152152
}

security/yama/yama_lsm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ static void report_access(const char *access, struct task_struct *target,
111111

112112
/**
113113
* yama_relation_cleanup - remove invalid entries from the relation list
114+
* @work: unused
114115
*
115116
*/
116117
static void yama_relation_cleanup(struct work_struct *work)

0 commit comments

Comments
 (0)