Merge tag 'for-linus-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull UML updates from Richard Weinberger:

- Move to strscpy()

- Improve panic notifiers

- Fix NR_CPUS usage

- Fixes for various comments

- Fixes for virtio driver

* tag 'for-linus-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
uml: Remove the initialization of statics to 0
um: Do not initialise statics to 0.
um: Fix comment typo
um: Improve panic notifiers consistency and ordering
um: remove unused reactivate_chan() declaration
um: mmaper: add __exit annotations to module exit funcs
um: virt-pci: add __init/__exit annotations to module init/exit funcs
hostfs: move from strlcpy with unused retval to strscpy
um: move from strlcpy with unused retval to strscpy
um: increase default virtual physical memory to 64 MiB
UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
um: read multiple msg from virtio slave request fd

+58 -57
-1
arch/um/drivers/chan.h
··· 36 int len); 37 extern int console_open_chan(struct line *line, struct console *co); 38 extern void deactivate_chan(struct chan *chan, int irq); 39 - extern void reactivate_chan(struct chan *chan, int irq); 40 extern void chan_enable_winch(struct chan *chan, struct tty_port *port); 41 extern int enable_chan(struct line *line); 42 extern void close_chan(struct line *line);
··· 36 int len); 37 extern int console_open_chan(struct line *line, struct console *co); 38 extern void deactivate_chan(struct chan *chan, int irq); 39 extern void chan_enable_winch(struct chan *chan, struct tty_port *port); 40 extern int enable_chan(struct line *line); 41 extern void close_chan(struct line *line);
+4 -5
arch/um/drivers/mconsole_kern.c
··· 283 }; 284 285 static DEFINE_MUTEX(plug_mem_mutex); 286 - static unsigned long long unplugged_pages_count = 0; 287 static LIST_HEAD(unplugged_pages); 288 static int unplug_index = UNPLUGGED_PER_PAGE; 289 ··· 846 847 mconsole_notify(notify_socket, MCONSOLE_PANIC, message, 848 strlen(message) + 1); 849 - return 0; 850 } 851 852 static struct notifier_block panic_exit_notifier = { 853 - .notifier_call = notify_panic, 854 - .next = NULL, 855 - .priority = 1 856 }; 857 858 static int add_notifier(void)
··· 283 }; 284 285 static DEFINE_MUTEX(plug_mem_mutex); 286 + static unsigned long long unplugged_pages_count; 287 static LIST_HEAD(unplugged_pages); 288 static int unplug_index = UNPLUGGED_PER_PAGE; 289 ··· 846 847 mconsole_notify(notify_socket, MCONSOLE_PANIC, message, 848 strlen(message) + 1); 849 + return NOTIFY_DONE; 850 } 851 852 static struct notifier_block panic_exit_notifier = { 853 + .notifier_call = notify_panic, 854 + .priority = INT_MAX, /* run as soon as possible */ 855 }; 856 857 static int add_notifier(void)
+1 -1
arch/um/drivers/mmapper_kern.c
··· 122 return 0; 123 } 124 125 - static void mmapper_exit(void) 126 { 127 misc_deregister(&mmapper_dev); 128 }
··· 122 return 0; 123 } 124 125 + static void __exit mmapper_exit(void) 126 { 127 misc_deregister(&mmapper_dev); 128 }
+1 -1
arch/um/drivers/net_kern.c
··· 265 static void uml_net_get_drvinfo(struct net_device *dev, 266 struct ethtool_drvinfo *info) 267 { 268 - strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); 269 } 270 271 static const struct ethtool_ops uml_net_ethtool_ops = {
··· 265 static void uml_net_get_drvinfo(struct net_device *dev, 266 struct ethtool_drvinfo *info) 267 { 268 + strscpy(info->driver, DRIVER_NAME, sizeof(info->driver)); 269 } 270 271 static const struct ethtool_ops uml_net_ethtool_ops = {
+1 -1
arch/um/drivers/ssl.c
··· 106 /* Changed by ssl_init and referenced by ssl_exit, which are both serialized 107 * by being an initcall and exitcall, respectively. 108 */ 109 - static int ssl_init_done = 0; 110 111 static void ssl_console_write(struct console *c, const char *string, 112 unsigned len)
··· 106 /* Changed by ssl_init and referenced by ssl_exit, which are both serialized 107 * by being an initcall and exitcall, respectively. 108 */ 109 + static int ssl_init_done; 110 111 static void ssl_console_write(struct console *c, const char *string, 112 unsigned len)
+1 -1
arch/um/drivers/stdio_console.c
··· 88 } 89 90 /* Set in an initcall, checked in an exitcall */ 91 - static int con_init_done = 0; 92 93 static int con_install(struct tty_driver *driver, struct tty_struct *tty) 94 {
··· 88 } 89 90 /* Set in an initcall, checked in an exitcall */ 91 + static int con_init_done; 92 93 static int con_install(struct tty_driver *driver, struct tty_struct *tty) 94 {
+1 -1
arch/um/drivers/ubd_kern.c
··· 1555 int kernel_fd = -1; 1556 1557 /* Only changed by the io thread. XXX: currently unused. */ 1558 - static int io_count = 0; 1559 1560 int io_thread(void *arg) 1561 {
··· 1555 int kernel_fd = -1; 1556 1557 /* Only changed by the io thread. XXX: currently unused. */ 1558 + static int io_count; 1559 1560 int io_thread(void *arg) 1561 {
+1 -1
arch/um/drivers/vector_kern.c
··· 1372 static void vector_net_get_drvinfo(struct net_device *dev, 1373 struct ethtool_drvinfo *info) 1374 { 1375 - strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); 1376 } 1377 1378 static int vector_net_load_bpf_flash(struct net_device *dev,
··· 1372 static void vector_net_get_drvinfo(struct net_device *dev, 1373 struct ethtool_drvinfo *info) 1374 { 1375 + strscpy(info->driver, DRIVER_NAME, sizeof(info->driver)); 1376 } 1377 1378 static int vector_net_load_bpf_flash(struct net_device *dev,
+2 -2
arch/um/drivers/virt-pci.c
··· 857 return um_pci_fwnode; 858 } 859 860 - static int um_pci_init(void) 861 { 862 int err, i; 863 ··· 940 } 941 module_init(um_pci_init); 942 943 - static void um_pci_exit(void) 944 { 945 unregister_virtio_driver(&um_pci_virtio_driver); 946 irq_domain_remove(um_pci_msi_domain);
··· 857 return um_pci_fwnode; 858 } 859 860 + static int __init um_pci_init(void) 861 { 862 int err, i; 863 ··· 940 } 941 module_init(um_pci_init); 942 943 + static void __exit um_pci_exit(void) 944 { 945 unregister_virtio_driver(&um_pci_virtio_driver); 946 irq_domain_remove(um_pci_msi_domain);
+36 -33
arch/um/drivers/virtio_uml.c
··· 374 u8 extra_payload[512]; 375 } msg; 376 int rc; 377 378 - rc = vhost_user_recv_req(vu_dev, &msg.msg, 379 - sizeof(msg.msg.payload) + 380 - sizeof(msg.extra_payload)); 381 382 - vu_dev->recv_rc = rc; 383 - if (rc) 384 - return IRQ_NONE; 385 - 386 - switch (msg.msg.header.request) { 387 - case VHOST_USER_SLAVE_CONFIG_CHANGE_MSG: 388 - vu_dev->config_changed_irq = true; 389 - response = 0; 390 - break; 391 - case VHOST_USER_SLAVE_VRING_CALL: 392 - virtio_device_for_each_vq((&vu_dev->vdev), vq) { 393 - if (vq->index == msg.msg.payload.vring_state.index) { 394 - response = 0; 395 - vu_dev->vq_irq_vq_map |= BIT_ULL(vq->index); 396 - break; 397 } 398 } 399 - break; 400 - case VHOST_USER_SLAVE_IOTLB_MSG: 401 - /* not supported - VIRTIO_F_ACCESS_PLATFORM */ 402 - case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: 403 - /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ 404 - default: 405 - vu_err(vu_dev, "unexpected slave request %d\n", 406 - msg.msg.header.request); 407 - } 408 409 - if (ev && !vu_dev->suspended) 410 - time_travel_add_irq_event(ev); 411 412 - if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) 413 - vhost_user_reply(vu_dev, &msg.msg, response); 414 - 415 - return IRQ_HANDLED; 416 } 417 418 static irqreturn_t vu_req_interrupt(int irq, void *data)
··· 374 u8 extra_payload[512]; 375 } msg; 376 int rc; 377 + irqreturn_t irq_rc = IRQ_NONE; 378 379 + while (1) { 380 + rc = vhost_user_recv_req(vu_dev, &msg.msg, 381 + sizeof(msg.msg.payload) + 382 + sizeof(msg.extra_payload)); 383 + if (rc) 384 + break; 385 386 + switch (msg.msg.header.request) { 387 + case VHOST_USER_SLAVE_CONFIG_CHANGE_MSG: 388 + vu_dev->config_changed_irq = true; 389 + response = 0; 390 + break; 391 + case VHOST_USER_SLAVE_VRING_CALL: 392 + virtio_device_for_each_vq((&vu_dev->vdev), vq) { 393 + if (vq->index == msg.msg.payload.vring_state.index) { 394 + response = 0; 395 + vu_dev->vq_irq_vq_map |= BIT_ULL(vq->index); 396 + break; 397 + } 398 } 399 + break; 400 + case VHOST_USER_SLAVE_IOTLB_MSG: 401 + /* not supported - VIRTIO_F_ACCESS_PLATFORM */ 402 + case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: 403 + /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ 404 + default: 405 + vu_err(vu_dev, "unexpected slave request %d\n", 406 + msg.msg.header.request); 407 } 408 409 + if (ev && !vu_dev->suspended) 410 + time_travel_add_irq_event(ev); 411 412 + if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) 413 + vhost_user_reply(vu_dev, &msg.msg, response); 414 + irq_rc = IRQ_HANDLED; 415 + }; 416 + /* mask EAGAIN as we try non-blocking read until socket is empty */ 417 + vu_dev->recv_rc = (rc == -EAGAIN) ? 0 : rc; 418 + return irq_rc; 419 } 420 421 static irqreturn_t vu_req_interrupt(int irq, void *data)
+1 -1
arch/um/kernel/physmem.c
··· 169 ); 170 171 /* 172 - * This list is constructed in parse_iomem and addresses filled in in 173 * setup_iomem, both of which run during early boot. Afterwards, it's 174 * unchanged. 175 */
··· 169 ); 170 171 /* 172 + * This list is constructed in parse_iomem and addresses filled in 173 * setup_iomem, both of which run during early boot. Afterwards, it's 174 * unchanged. 175 */
+7 -7
arch/um/kernel/um_arch.c
··· 96 97 static void *c_start(struct seq_file *m, loff_t *pos) 98 { 99 - return *pos < NR_CPUS ? cpu_data + *pos : NULL; 100 } 101 102 static void *c_next(struct seq_file *m, void *v, loff_t *pos) ··· 132 static int have_console __initdata; 133 134 /* Set in uml_mem_setup and modified in linux_main */ 135 - long long physmem_size = 32 * 1024 * 1024; 136 EXPORT_SYMBOL(physmem_size); 137 138 static const char *usage_string = ··· 247 bust_spinlocks(0); 248 uml_exitcode = 1; 249 os_dump_core(); 250 - return 0; 251 } 252 253 static struct notifier_block panic_exit_notifier = { 254 - .notifier_call = panic_exit, 255 - .next = NULL, 256 - .priority = 0 257 }; 258 259 void uml_finishsetup(void) ··· 416 read_initrd(); 417 418 paging_init(); 419 - strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 420 *cmdline_p = command_line; 421 setup_hostinfo(host_info, sizeof host_info); 422
··· 96 97 static void *c_start(struct seq_file *m, loff_t *pos) 98 { 99 + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; 100 } 101 102 static void *c_next(struct seq_file *m, void *v, loff_t *pos) ··· 132 static int have_console __initdata; 133 134 /* Set in uml_mem_setup and modified in linux_main */ 135 + long long physmem_size = 64 * 1024 * 1024; 136 EXPORT_SYMBOL(physmem_size); 137 138 static const char *usage_string = ··· 247 bust_spinlocks(0); 248 uml_exitcode = 1; 249 os_dump_core(); 250 + 251 + return NOTIFY_DONE; 252 } 253 254 static struct notifier_block panic_exit_notifier = { 255 + .notifier_call = panic_exit, 256 + .priority = INT_MAX - 1, /* run as 2nd notifier, won't return */ 257 }; 258 259 void uml_finishsetup(void) ··· 416 read_initrd(); 417 418 paging_init(); 419 + strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 420 *cmdline_p = command_line; 421 setup_hostinfo(host_info, sizeof host_info); 422
+1 -1
arch/um/kernel/umid.c
··· 9 #include <os.h> 10 11 /* Changed by set_umid_arg */ 12 - static int umid_inited = 0; 13 14 static int __init set_umid_arg(char *name, int *add) 15 {
··· 9 #include <os.h> 10 11 /* Changed by set_umid_arg */ 12 + static int umid_inited; 13 14 static int __init set_umid_arg(char *name, int *add) 15 {
+1 -1
fs/hostfs/hostfs_kern.c
··· 103 */ 104 BUG_ON(p + strlen(p) + 1 != name + PATH_MAX); 105 106 - strlcpy(name, root, PATH_MAX); 107 if (len > p - name) { 108 __putname(name); 109 return NULL;
··· 103 */ 104 BUG_ON(p + strlen(p) + 1 != name + PATH_MAX); 105 106 + strscpy(name, root, PATH_MAX); 107 if (len > p - name) { 108 __putname(name); 109 return NULL;