diff options
author | Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> | 2021-05-19 09:41:35 +0000 |
---|---|---|
committer | Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> | 2021-05-19 09:41:35 +0000 |
commit | 2cbb55e591febb414b623269d61d4444113c285f (patch) | |
tree | c18865a0ddcee5fefce57d3b43b18b61074d8f32 /lib | |
parent | ef2339380856bee33c1ae25535ff0d72c92d02ad (diff) | |
parent | e05d387ba736bcabe414b0aa05831d151ac40385 (diff) |
Merge tag 'v5.4.120' into 5.4-2.3.x-imx
This is the 5.4.120 stable release
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject_uevent.c | 9 | ||||
-rw-r--r-- | lib/nlattr.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 7998affa45d4..c87d5b6a8a55 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -251,12 +251,13 @@ static int kobj_usermode_filter(struct kobject *kobj) static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem) { + int buffer_size = sizeof(env->buf) - env->buflen; int len; - len = strlcpy(&env->buf[env->buflen], subsystem, - sizeof(env->buf) - env->buflen); - if (len >= (sizeof(env->buf) - env->buflen)) { - WARN(1, KERN_ERR "init_uevent_argv: buffer size too small\n"); + len = strlcpy(&env->buf[env->buflen], subsystem, buffer_size); + if (len >= buffer_size) { + pr_warn("init_uevent_argv: buffer size of %d too small, needed %d\n", + buffer_size, len); return -ENOMEM; } diff --git a/lib/nlattr.c b/lib/nlattr.c index cace9b307781..0d84f79cb4b5 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -609,7 +609,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str) int attrlen = nla_len(nla); int d; - if (attrlen > 0 && buf[attrlen - 1] == '\0') + while (attrlen > 0 && buf[attrlen - 1] == '\0') attrlen--; d = attrlen - len; |