* + sysctl-use-generic-uuid-library.patch added to -mm tree
@ 2016-04-04 23:40 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2016-04-04 23:40 UTC (permalink / raw)
To: andriy.shevchenko, arnd, linux, matt, tytso, mm-commits
The patch titled
Subject: sysctl: use generic UUID library
has been added to the -mm tree. Its filename is
sysctl-use-generic-uuid-library.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/sysctl-use-generic-uuid-library.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/sysctl-use-generic-uuid-library.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: sysctl: use generic UUID library
UUID library provides uuid_be type and uuid_be_to_bin() function. This
substitutes open coded variant by generic library calls.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/sysctl_binary.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff -puN kernel/sysctl_binary.c~sysctl-use-generic-uuid-library kernel/sysctl_binary.c
--- a/kernel/sysctl_binary.c~sysctl-use-generic-uuid-library
+++ a/kernel/sysctl_binary.c
@@ -13,6 +13,7 @@
#include <linux/ctype.h>
#include <linux/netdevice.h>
#include <linux/kernel.h>
+#include <linux/uuid.h>
#include <linux/slab.h>
#include <linux/compat.h>
@@ -1117,9 +1118,8 @@ static ssize_t bin_uuid(struct file *fil
/* Only supports reads */
if (oldval && oldlen) {
- char buf[40], *str = buf;
- unsigned char uuid[16];
- int i;
+ char buf[UUID_STRING_LEN + 1];
+ uuid_be uuid;
result = kernel_read(file, 0, buf, sizeof(buf) - 1);
if (result < 0)
@@ -1128,21 +1128,13 @@ static ssize_t bin_uuid(struct file *fil
buf[result] = '\0';
/* Convert the uuid to from a string to binary */
- for (i = 0; i < 16; i++) {
- if (!isxdigit(str[0]) || !isxdigit(str[1]))
- return -EIO;
-
- uuid[i] = (hex_to_bin(str[0]) << 4) |
- hex_to_bin(str[1]);
- str += 2;
- if (*str == '-')
- str++;
- }
+ if (uuid_be_to_bin(buf, &uuid))
+ return -EIO;
if (oldlen > 16)
oldlen = 16;
- if (copy_to_user(oldval, uuid, oldlen))
+ if (copy_to_user(oldval, &uuid, oldlen))
return -EFAULT;
copied = oldlen;
_
Patches currently in -mm which might be from andriy.shevchenko@linux.intel.com are
lib-vsprintf-simplify-uuid-printing.patch
lib-uuid-move-generate_random_uuid-to-uuidc.patch
lib-uuid-introduce-few-more-generic-helpers-for-uuid.patch
lib-uuid-remove-fsf-address.patch
sysctl-drop-away-useless-label.patch
sysctl-use-generic-uuid-library.patch
efi-redefine-type-constant-macro-from-generic-code.patch
efivars-use-generic-uuid-library.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + sysctl-use-generic-uuid-library.patch added to -mm tree
@ 2016-04-05 22:17 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2016-04-05 22:17 UTC (permalink / raw)
To: andriy.shevchenko, arnd, axboe, dmitry.kasatkin, linux, matt,
tytso, viro, zohar, mm-commits
The patch titled
Subject: kernel/sysctl_binary.c: use generic UUID library
has been added to the -mm tree. Its filename is
sysctl-use-generic-uuid-library.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/sysctl-use-generic-uuid-library.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/sysctl-use-generic-uuid-library.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: kernel/sysctl_binary.c: use generic UUID library
UUID library provides uuid_be type and uuid_be_to_bin() function. This
substitutes open coded variant by generic library calls.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/sysctl_binary.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff -puN kernel/sysctl_binary.c~sysctl-use-generic-uuid-library kernel/sysctl_binary.c
--- a/kernel/sysctl_binary.c~sysctl-use-generic-uuid-library
+++ a/kernel/sysctl_binary.c
@@ -13,6 +13,7 @@
#include <linux/ctype.h>
#include <linux/netdevice.h>
#include <linux/kernel.h>
+#include <linux/uuid.h>
#include <linux/slab.h>
#include <linux/compat.h>
@@ -1117,9 +1118,8 @@ static ssize_t bin_uuid(struct file *fil
/* Only supports reads */
if (oldval && oldlen) {
- char buf[40], *str = buf;
- unsigned char uuid[16];
- int i;
+ char buf[UUID_STRING_LEN + 1];
+ uuid_be uuid;
result = kernel_read(file, 0, buf, sizeof(buf) - 1);
if (result < 0)
@@ -1127,24 +1127,15 @@ static ssize_t bin_uuid(struct file *fil
buf[result] = '\0';
- /* Convert the uuid to from a string to binary */
- for (i = 0; i < 16; i++) {
- result = -EIO;
- if (!isxdigit(str[0]) || !isxdigit(str[1]))
- goto out;
-
- uuid[i] = (hex_to_bin(str[0]) << 4) |
- hex_to_bin(str[1]);
- str += 2;
- if (*str == '-')
- str++;
- }
+ result = -EIO;
+ if (uuid_be_to_bin(buf, &uuid))
+ goto out;
if (oldlen > 16)
oldlen = 16;
result = -EFAULT;
- if (copy_to_user(oldval, uuid, oldlen))
+ if (copy_to_user(oldval, &uuid, oldlen))
goto out;
copied = oldlen;
_
Patches currently in -mm which might be from andriy.shevchenko@linux.intel.com are
lib-vsprintf-simplify-uuid-printing.patch
ima-use-%pu-to-output-uuid-in-printable-format.patch
lib-uuid-move-generate_random_uuid-to-uuidc.patch
lib-uuid-introduce-few-more-generic-helpers-for-uuid.patch
lib-uuid-remove-fsf-address.patch
sysctl-use-generic-uuid-library.patch
efi-redefine-type-constant-macro-from-generic-code.patch
efivars-use-generic-uuid-library.patch
genhd-move-to-use-generic-uuid-library.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-05 22:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 23:40 + sysctl-use-generic-uuid-library.patch added to -mm tree akpm
2016-04-05 22:17 akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.