Skip to content

Commit dc5341f

Browse files
committed
Merge tag 'for-5.17/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull more parisc architecture updates from Helge Deller: "Fixes and enhancements: - a memory leak fix in an error path in pdc_stable (Miaoqian Lin) - two compiler warning fixes in the TOC code - added autodetection for currently used console type (serial or graphics) which inserts console=<type> if it's missing" * tag 'for-5.17/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries parisc: Fix missing prototype for 'toc_intr' warning in toc.c parisc: Autodetect default output device and set console= kernel parameter parisc: Use safer strscpy() in setup_cmdline() parisc: Add visible flag to toc_stack variable
2 parents 7867e40 + d24846a commit dc5341f

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

arch/parisc/include/asm/processor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ extern int _parisc_requires_coherency;
289289

290290
extern int running_on_qemu;
291291

292+
extern void __noreturn toc_intr(struct pt_regs *regs);
292293
extern void toc_handler(void);
293294
extern unsigned int toc_handler_size;
294295
extern unsigned int toc_handler_csum;

arch/parisc/kernel/setup.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
4848
void __init setup_cmdline(char **cmdline_p)
4949
{
5050
extern unsigned int boot_args[];
51+
char *p;
5152

5253
/* Collect stuff passed in from the boot loader */
5354

@@ -56,9 +57,19 @@ void __init setup_cmdline(char **cmdline_p)
5657
/* called from hpux boot loader */
5758
boot_command_line[0] = '\0';
5859
} else {
59-
strlcpy(boot_command_line, (char *)__va(boot_args[1]),
60+
strscpy(boot_command_line, (char *)__va(boot_args[1]),
6061
COMMAND_LINE_SIZE);
6162

63+
/* autodetect console type (if not done by palo yet) */
64+
p = boot_command_line;
65+
if (!str_has_prefix(p, "console=") && !strstr(p, " console=")) {
66+
strlcat(p, " console=", COMMAND_LINE_SIZE);
67+
if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
68+
strlcat(p, "ttyS0", COMMAND_LINE_SIZE);
69+
else
70+
strlcat(p, "tty0", COMMAND_LINE_SIZE);
71+
}
72+
6273
#ifdef CONFIG_BLK_DEV_INITRD
6374
if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
6475
{
@@ -68,7 +79,7 @@ void __init setup_cmdline(char **cmdline_p)
6879
#endif
6980
}
7081

71-
strcpy(command_line, boot_command_line);
82+
strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
7283
*cmdline_p = command_line;
7384
}
7485

arch/parisc/kernel/toc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#include <asm/pdc.h>
1111
#include <asm/pdc_chassis.h>
1212
#include <asm/ldcw.h>
13+
#include <asm/processor.h>
1314

1415
static unsigned int __aligned(16) toc_lock = 1;
15-
DEFINE_PER_CPU_PAGE_ALIGNED(char [16384], toc_stack);
16+
DEFINE_PER_CPU_PAGE_ALIGNED(char [16384], toc_stack) __visible;
1617

1718
static void toc20_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_20 *toc)
1819
{

drivers/parisc/pdc_stable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,10 @@ pdcs_register_pathentries(void)
980980
entry->kobj.kset = paths_kset;
981981
err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL,
982982
"%s", entry->name);
983-
if (err)
983+
if (err) {
984+
kobject_put(&entry->kobj);
984985
return err;
986+
}
985987

986988
/* kobject is now registered */
987989
write_lock(&entry->rw_lock);

0 commit comments

Comments
 (0)