Merge tag 'printk-for-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/printk...
[linux-2.6-microblaze.git] / kernel / printk / printk.c
index 1685a71..b06f63e 100644 (file)
@@ -615,17 +615,6 @@ static int check_syslog_permissions(int type, int source)
        if (syslog_action_restricted(type)) {
                if (capable(CAP_SYSLOG))
                        goto ok;
-               /*
-                * For historical reasons, accept CAP_SYS_ADMIN too, with
-                * a warning.
-                */
-               if (capable(CAP_SYS_ADMIN)) {
-                       pr_warn_once("%s (%d): Attempt to access syslog with "
-                                    "CAP_SYS_ADMIN but no CAP_SYSLOG "
-                                    "(deprecated).\n",
-                                current->comm, task_pid_nr(current));
-                       goto ok;
-               }
                return -EPERM;
        }
 ok:
@@ -2434,12 +2423,20 @@ static void set_user_specified(struct console_cmdline *c, bool user_specified)
        console_set_on_cmdline = 1;
 }
 
-static int __add_preferred_console(char *name, int idx, char *options,
+static int __add_preferred_console(const char *name, const short idx, char *options,
                                   char *brl_options, bool user_specified)
 {
        struct console_cmdline *c;
        int i;
 
+       /*
+        * We use a signed short index for struct console for device drivers to
+        * indicate a not yet assigned index or port. However, a negative index
+        * value is not valid for preferred console.
+        */
+       if (idx < 0)
+               return -EINVAL;
+
        /*
         *      See if this tty is not yet registered, and
         *      if we have a slot free.
@@ -2543,7 +2540,7 @@ __setup("console=", console_setup);
  * commonly to provide a default console (ie from PROM variables) when
  * the user has not supplied one.
  */
-int add_preferred_console(char *name, int idx, char *options)
+int add_preferred_console(const char *name, const short idx, char *options)
 {
        return __add_preferred_console(name, idx, options, NULL, false);
 }