Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686719

[PATCH 4.4 01/57] fs: add a VALID_OPEN_FLAGS

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 01/57] fs: add a VALID_OPEN_FLAGS
Date 2017-07-13 18:00 +0200
Message-ID <u2OH2-7vy-53@gated-at.bofh.it> (permalink)
References <u2Oxj-7s0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christoph Hellwig <hch@lst.de>

commit 80f18379a7c350c011d30332658aa15fe49a8fa5 upstream.

Add a central define for all valid open flags, and use it in the uniqueness
check.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/fcntl.c            |   14 ++++----------
 include/linux/fcntl.h |    6 ++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -740,16 +740,10 @@ static int __init fcntl_init(void)
 	 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
 	 * is defined as O_NONBLOCK on some platforms and not on others.
 	 */
-	BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
-		O_RDONLY	| O_WRONLY	| O_RDWR	|
-		O_CREAT		| O_EXCL	| O_NOCTTY	|
-		O_TRUNC		| O_APPEND	| /* O_NONBLOCK	| */
-		__O_SYNC	| O_DSYNC	| FASYNC	|
-		O_DIRECT	| O_LARGEFILE	| O_DIRECTORY	|
-		O_NOFOLLOW	| O_NOATIME	| O_CLOEXEC	|
-		__FMODE_EXEC	| O_PATH	| __O_TMPFILE	|
-		__FMODE_NONOTIFY
-		));
+	BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ !=
+		HWEIGHT32(
+			(VALID_OPEN_FLAGS & ~(O_NONBLOCK | O_NDELAY)) |
+			__FMODE_EXEC | __FMODE_NONOTIFY));
 
 	fasync_cache = kmem_cache_create("fasync_cache",
 		sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -3,6 +3,12 @@
 
 #include <uapi/linux/fcntl.h>
 
+/* list of all valid flags for the open/openat flags argument: */
+#define VALID_OPEN_FLAGS \
+	(O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
+	 O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
+	 FASYNC	| O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
+	 O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
 
 #ifndef force_o_largefile
 #define force_o_largefile() (BITS_PER_LONG != 32)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 27/57] ath10k: override CE5 config for QCA9377 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 12/57] usb: Fix typo in the definition of Endpoint[out]Request Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 50/57] md: fix incorrect use of lexx_to_cpu in does_sb_need_changing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 54/57] staging: comedi: fix clean-up of comedi_class in comedi_init() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 11/57] usb: usbip: set buffer pointers to NULL after free Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 45/57] perf pmu: Fix misleadingly indented assignment (whitespace) Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 17:50 +0200
  [PATCH 4.4 13/57] mac80211_hwsim: Replace bogus hrtimer clockid Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 39/57] perf bench numa: Avoid possible truncation when using snprintf() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 10/57] Add USB quirk for HVR-950q to avoid intermittent device resets Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 06/57] tracing/kprobes: Allow to create probe with a module name starting with a digit Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 02/57] fs: completely ignore unknown open flags Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 09/57] USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 43/57] perf tools: Remove duplicate const qualifier Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 31/57] tools include: Add a __fallthrough statement Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 16/57] pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 15/57] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 37/57] perf scripting perl: Fix compile error with some perl5 versions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 41/57] perf thread_map: Use readdir() instead of deprecated readdir_r() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 01/57] fs: add a VALID_OPEN_FLAGS Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 40/57] perf tools: Use readdir() instead of deprecated readdir_r() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 34/57] perf top: Use __fallthrough Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 33/57] tools strfilter: Use __fallthrough Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 32/57] tools string: Use __fallthrough in perf_atoll() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 19/57] pinctrl: sunxi: Fix SPDIF function name for A83T Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 35/57] perf intel-pt: Use __fallthrough Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  [PATCH 4.4 17/57] pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-13 18:00 +0200
  Re: [PATCH 4.4 00/57] 4.4.77-stable review Guenter Roeck <linux@roeck-us.net> - 2017-07-14 03:40 +0200
    Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-14 12:00 +0200
      Re: [PATCH 4.4 00/57] 4.4.77-stable review Guenter Roeck <linux@roeck-us.net> - 2017-07-14 21:30 +0200
        Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-15 10:20 +0200
  Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-14 12:00 +0200
    Re: [PATCH 4.4 00/57] 4.4.77-stable review Arnd Bergmann <arnd@arndb.de> - 2017-07-14 14:30 +0200
      Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-14 15:30 +0200
        Re: [PATCH 4.4 00/57] 4.4.77-stable review Arnd Bergmann <arnd@arndb.de> - 2017-07-14 22:00 +0200
        Re: [PATCH 4.4 00/57] 4.4.77-stable review Geert Uytterhoeven <geert@linux-m68k.org> - 2017-07-15 13:20 +0200
          Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-15 13:30 +0200
    Re: [PATCH 4.4 00/57] 4.4.77-stable review Mark Brown <broonie@kernel.org> - 2017-07-14 14:40 +0200
      Re: [PATCH 4.4 00/57] 4.4.77-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-14 15:30 +0200

csiph-web