Merge tag 'printk-for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk
Pull printk updates from Petr Mladek: - Fix off-by-one error when calculating messages that might fit into kmsg buffer. It causes occasional omitting of the last message. - Add missing pointer check in %pD format modifier handling. - Some clean up * tag 'printk-for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: ABI: Update dev-kmsg documentation to match current kernel behaviour printk: Replace strncmp() with str_has_prefix() lib/test_printf: Remove obvious comments from %pd and %pD tests lib/test_printf: Add test of null/invalid pointer dereference for dentry vsprintf: Prevent crash when dereferencing invalid pointers for %pD printk: Do not lose last line in kmsg buffer dump
This commit is contained in:
@@ -11,11 +11,18 @@
|
||||
|
||||
int _braille_console_setup(char **str, char **brl_options)
|
||||
{
|
||||
if (!strncmp(*str, "brl,", 4)) {
|
||||
size_t len;
|
||||
|
||||
len = str_has_prefix(*str, "brl,");
|
||||
if (len) {
|
||||
*brl_options = "";
|
||||
*str += 4;
|
||||
} else if (!strncmp(*str, "brl=", 4)) {
|
||||
*brl_options = *str + 4;
|
||||
*str += len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = str_has_prefix(*str, "brl=");
|
||||
if (len) {
|
||||
*brl_options = *str + len;
|
||||
*str = strchr(*brl_options, ',');
|
||||
if (!*str) {
|
||||
pr_err("need port name after brl=\n");
|
||||
|
@@ -118,19 +118,29 @@ static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
|
||||
|
||||
static int __control_devkmsg(char *str)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (!str)
|
||||
return -EINVAL;
|
||||
|
||||
if (!strncmp(str, "on", 2)) {
|
||||
len = str_has_prefix(str, "on");
|
||||
if (len) {
|
||||
devkmsg_log = DEVKMSG_LOG_MASK_ON;
|
||||
return 2;
|
||||
} else if (!strncmp(str, "off", 3)) {
|
||||
devkmsg_log = DEVKMSG_LOG_MASK_OFF;
|
||||
return 3;
|
||||
} else if (!strncmp(str, "ratelimit", 9)) {
|
||||
devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
|
||||
return 9;
|
||||
return len;
|
||||
}
|
||||
|
||||
len = str_has_prefix(str, "off");
|
||||
if (len) {
|
||||
devkmsg_log = DEVKMSG_LOG_MASK_OFF;
|
||||
return len;
|
||||
}
|
||||
|
||||
len = str_has_prefix(str, "ratelimit");
|
||||
if (len) {
|
||||
devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
|
||||
return len;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -3274,7 +3284,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
|
||||
/* move first record forward until length fits into the buffer */
|
||||
seq = dumper->cur_seq;
|
||||
idx = dumper->cur_idx;
|
||||
while (l > size && seq < dumper->next_seq) {
|
||||
while (l >= size && seq < dumper->next_seq) {
|
||||
struct printk_log *msg = log_from_idx(idx);
|
||||
|
||||
l -= msg_print_text(msg, true, time, NULL, 0);
|
||||
|
Fai riferimento in un nuovo problema
Block a user