diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-07 11:17:34 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-07 11:17:34 +0200 |
commit | b7a4abb67416aa07cd65446dd39e64525ccfe8e5 (patch) | |
tree | 8f5b0f9ffb617622944b5e6368473f91e3efeaa4 /lib | |
parent | d30323f810e4da94eb75cf4bfe5165b9518c64df (diff) | |
parent | f22e6e847115abc3a0e2ad7bb18d243d42275af1 (diff) |
Merge 4.0-rc7 into usb-next
We want the fixes in here, and to help resolve merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lcm.c | 11 | ||||
-rw-r--r-- | lib/nlattr.c | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/lcm.c b/lib/lcm.c index e97dbd51e756..03d7fcb420b5 100644 --- a/lib/lcm.c +++ b/lib/lcm.c @@ -12,3 +12,14 @@ unsigned long lcm(unsigned long a, unsigned long b) return 0; } EXPORT_SYMBOL_GPL(lcm); + +unsigned long lcm_not_zero(unsigned long a, unsigned long b) +{ + unsigned long l = lcm(a, b); + + if (l) + return l; + + return (b ? : a); +} +EXPORT_SYMBOL_GPL(lcm_not_zero); diff --git a/lib/nlattr.c b/lib/nlattr.c index 76a1b59523ab..f5907d23272d 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -279,6 +279,8 @@ int nla_memcpy(void *dest, const struct nlattr *src, int count) int minlen = min_t(int, count, nla_len(src)); memcpy(dest, nla_data(src), minlen); + if (count > minlen) + memset(dest + minlen, 0, count - minlen); return minlen; } |