parisc architecture fixes & enhancements for kernel v5.17-rc1

- 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
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCYesyJAAKCRD3ErUQojoP
 X4/fAQDSAarbWUqr3zWo3UU9iBtaCJwD85nWK44R+SSdWon7yQD/bF9YvLMbGnGR
 lp8quJafFpgwUWJ9DV7PCzIroUDLCAo=
 =o8u9
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-01-22 09:37:31 +02:00
Родитель 7867e40278 d24846a424
Коммит dc5341f41d
4 изменённых файлов: 19 добавлений и 4 удалений

Просмотреть файл

@ -289,6 +289,7 @@ extern int _parisc_requires_coherency;
extern int running_on_qemu;
extern void __noreturn toc_intr(struct pt_regs *regs);
extern void toc_handler(void);
extern unsigned int toc_handler_size;
extern unsigned int toc_handler_csum;

Просмотреть файл

@ -48,6 +48,7 @@ struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
void __init setup_cmdline(char **cmdline_p)
{
extern unsigned int boot_args[];
char *p;
/* Collect stuff passed in from the boot loader */
@ -56,9 +57,19 @@ void __init setup_cmdline(char **cmdline_p)
/* called from hpux boot loader */
boot_command_line[0] = '\0';
} else {
strlcpy(boot_command_line, (char *)__va(boot_args[1]),
strscpy(boot_command_line, (char *)__va(boot_args[1]),
COMMAND_LINE_SIZE);
/* autodetect console type (if not done by palo yet) */
p = boot_command_line;
if (!str_has_prefix(p, "console=") && !strstr(p, " console=")) {
strlcat(p, " console=", COMMAND_LINE_SIZE);
if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
strlcat(p, "ttyS0", COMMAND_LINE_SIZE);
else
strlcat(p, "tty0", COMMAND_LINE_SIZE);
}
#ifdef CONFIG_BLK_DEV_INITRD
if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
{
@ -68,7 +79,7 @@ void __init setup_cmdline(char **cmdline_p)
#endif
}
strcpy(command_line, boot_command_line);
strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
}

Просмотреть файл

@ -10,9 +10,10 @@
#include <asm/pdc.h>
#include <asm/pdc_chassis.h>
#include <asm/ldcw.h>
#include <asm/processor.h>
static unsigned int __aligned(16) toc_lock = 1;
DEFINE_PER_CPU_PAGE_ALIGNED(char [16384], toc_stack);
DEFINE_PER_CPU_PAGE_ALIGNED(char [16384], toc_stack) __visible;
static void toc20_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_20 *toc)
{

Просмотреть файл

@ -980,8 +980,10 @@ pdcs_register_pathentries(void)
entry->kobj.kset = paths_kset;
err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL,
"%s", entry->name);
if (err)
if (err) {
kobject_put(&entry->kobj);
return err;
}
/* kobject is now registered */
write_lock(&entry->rw_lock);