Skip to content

Commit 4288e6b

Browse files
committed
Merge tag 'driver-core-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH: "Here are two driver core fixes for 4.15-rc6, resolving some reported issues. The first is a cacheinfo fix for DT based systems to resolve a reported issue that has been around for a while, and the other is to resolve a regression in the kobject uevent code that showed up in 4.15-rc1. Both have been in linux-next for a while with no reported issues" * tag 'driver-core-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: kobject: fix suppressing modalias in uevents delivered over netlink drivers: base: cacheinfo: fix cache type for non-architected system cache
2 parents 29a9b00 + 9b3fa47 commit 4288e6b

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

drivers/base/cacheinfo.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ static void cache_associativity(struct cacheinfo *this_leaf)
186186
this_leaf->ways_of_associativity = (size / nr_sets) / line_size;
187187
}
188188

189+
static bool cache_node_is_unified(struct cacheinfo *this_leaf)
190+
{
191+
return of_property_read_bool(this_leaf->of_node, "cache-unified");
192+
}
193+
189194
static void cache_of_override_properties(unsigned int cpu)
190195
{
191196
int index;
@@ -194,6 +199,14 @@ static void cache_of_override_properties(unsigned int cpu)
194199

195200
for (index = 0; index < cache_leaves(cpu); index++) {
196201
this_leaf = this_cpu_ci->info_list + index;
202+
/*
203+
* init_cache_level must setup the cache level correctly
204+
* overriding the architecturally specified levels, so
205+
* if type is NONE at this stage, it should be unified
206+
*/
207+
if (this_leaf->type == CACHE_TYPE_NOCACHE &&
208+
cache_node_is_unified(this_leaf))
209+
this_leaf->type = CACHE_TYPE_UNIFIED;
197210
cache_size(this_leaf);
198211
cache_get_line_size(this_leaf);
199212
cache_nr_sets(this_leaf);

lib/kobject_uevent.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
346346
static void zap_modalias_env(struct kobj_uevent_env *env)
347347
{
348348
static const char modalias_prefix[] = "MODALIAS=";
349-
int i;
349+
size_t len;
350+
int i, j;
350351

351352
for (i = 0; i < env->envp_idx;) {
352353
if (strncmp(env->envp[i], modalias_prefix,
@@ -355,11 +356,18 @@ static void zap_modalias_env(struct kobj_uevent_env *env)
355356
continue;
356357
}
357358

358-
if (i != env->envp_idx - 1)
359-
memmove(&env->envp[i], &env->envp[i + 1],
360-
sizeof(env->envp[i]) * env->envp_idx - 1);
359+
len = strlen(env->envp[i]) + 1;
360+
361+
if (i != env->envp_idx - 1) {
362+
memmove(env->envp[i], env->envp[i + 1],
363+
env->buflen - len);
364+
365+
for (j = i; j < env->envp_idx - 1; j++)
366+
env->envp[j] = env->envp[j + 1] - len;
367+
}
361368

362369
env->envp_idx--;
370+
env->buflen -= len;
363371
}
364372
}
365373

0 commit comments

Comments
 (0)