Skip to content

Commit 7ec85f3

Browse files
committed
Merge tag 'printk-for-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - Code cleanup and dead code removal * tag 'printk-for-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: printk: Remove obsoleted check for non-existent "user" object lib/vsprintf: Use isodigit() for the octal number check Remove orphaned CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT
2 parents df45da5 + bee4390 commit 7ec85f3

File tree

7 files changed

+2
-41
lines changed

7 files changed

+2
-41
lines changed

arch/powerpc/configs/microwatt_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ CONFIG_HIGH_RES_TIMERS=y
44
CONFIG_PREEMPT_VOLUNTARY=y
55
CONFIG_TICK_CPU_ACCOUNTING=y
66
CONFIG_LOG_BUF_SHIFT=16
7-
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
87
CONFIG_CGROUPS=y
98
CONFIG_BLK_DEV_INITRD=y
109
CONFIG_CC_OPTIMIZE_FOR_SIZE=y

arch/riscv/configs/nommu_k210_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# CONFIG_CPU_ISOLATION is not set
22
CONFIG_LOG_BUF_SHIFT=13
3-
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
43
CONFIG_BLK_DEV_INITRD=y
54
# CONFIG_RD_GZIP is not set
65
# CONFIG_RD_BZIP2 is not set

arch/riscv/configs/nommu_k210_sdcard_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# CONFIG_CPU_ISOLATION is not set
22
CONFIG_LOG_BUF_SHIFT=13
3-
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
43
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54
# CONFIG_SYSFS_SYSCALL is not set
65
# CONFIG_FHANDLE is not set

arch/riscv/configs/nommu_virt_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# CONFIG_CPU_ISOLATION is not set
22
CONFIG_LOG_BUF_SHIFT=16
3-
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
43
CONFIG_BLK_DEV_INITRD=y
54
# CONFIG_RD_BZIP2 is not set
65
# CONFIG_RD_LZMA is not set

init/Kconfig

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -765,30 +765,6 @@ config LOG_CPU_MAX_BUF_SHIFT
765765
13 => 8 KB for each CPU
766766
12 => 4 KB for each CPU
767767

768-
config PRINTK_SAFE_LOG_BUF_SHIFT
769-
int "Temporary per-CPU printk log buffer size (12 => 4KB, 13 => 8KB)"
770-
range 10 21
771-
default 13
772-
depends on PRINTK
773-
help
774-
Select the size of an alternate printk per-CPU buffer where messages
775-
printed from unsafe contexts are temporary stored. One example would
776-
be NMI messages, another one - printk recursion. The messages are
777-
copied to the main log buffer in a safe context to avoid a deadlock.
778-
The value defines the size as a power of 2.
779-
780-
Those messages are rare and limited. The largest one is when
781-
a backtrace is printed. It usually fits into 4KB. Select
782-
8KB if you want to be on the safe side.
783-
784-
Examples:
785-
17 => 128 KB for each CPU
786-
16 => 64 KB for each CPU
787-
15 => 32 KB for each CPU
788-
14 => 16 KB for each CPU
789-
13 => 8 KB for each CPU
790-
12 => 4 KB for each CPU
791-
792768
config PRINTK_INDEX
793769
bool "Printk indexing debugfs interface"
794770
depends on PRINTK && DEBUG_FS

kernel/printk/printk.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
730730
size_t len = iov_iter_count(from);
731731
ssize_t ret = len;
732732

733-
if (!user || len > PRINTKRB_RECORD_MAX)
733+
if (len > PRINTKRB_RECORD_MAX)
734734
return -EINVAL;
735735

736736
/* Ignore when user logging is disabled. */
@@ -792,9 +792,6 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
792792
};
793793
ssize_t ret;
794794

795-
if (!user)
796-
return -EBADF;
797-
798795
ret = mutex_lock_interruptible(&user->lock);
799796
if (ret)
800797
return ret;
@@ -859,8 +856,6 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
859856
struct devkmsg_user *user = file->private_data;
860857
loff_t ret = 0;
861858

862-
if (!user)
863-
return -EBADF;
864859
if (offset)
865860
return -ESPIPE;
866861

@@ -893,9 +888,6 @@ static __poll_t devkmsg_poll(struct file *file, poll_table *wait)
893888
struct printk_info info;
894889
__poll_t ret = 0;
895890

896-
if (!user)
897-
return EPOLLERR|EPOLLNVAL;
898-
899891
poll_wait(file, &log_wait, wait);
900892

901893
if (prb_read_valid_info(prb, atomic64_read(&user->seq), &info, NULL)) {
@@ -944,9 +936,6 @@ static int devkmsg_release(struct inode *inode, struct file *file)
944936
{
945937
struct devkmsg_user *user = file->private_data;
946938

947-
if (!user)
948-
return 0;
949-
950939
ratelimit_state_exit(&user->rs);
951940

952941
mutex_destroy(&user->lock);

lib/vsprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
36213621
if (!digit
36223622
|| (base == 16 && !isxdigit(digit))
36233623
|| (base == 10 && !isdigit(digit))
3624-
|| (base == 8 && (!isdigit(digit) || digit > '7'))
3624+
|| (base == 8 && !isodigit(digit))
36253625
|| (base == 0 && !isdigit(digit)))
36263626
break;
36273627

0 commit comments

Comments
 (0)