Skip to content

Commit 91080ab

Browse files
committed
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
2 parents 73344a3 + 193cb83 commit 91080ab

File tree

14 files changed

+59
-58
lines changed

14 files changed

+59
-58
lines changed

arch/um/drivers/chan.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ extern int console_write_chan(struct chan *chan, const char *buf,
3636
int len);
3737
extern int console_open_chan(struct line *line, struct console *co);
3838
extern void deactivate_chan(struct chan *chan, int irq);
39-
extern void reactivate_chan(struct chan *chan, int irq);
4039
extern void chan_enable_winch(struct chan *chan, struct tty_port *port);
4140
extern int enable_chan(struct line *line);
4241
extern void close_chan(struct line *line);

arch/um/drivers/mconsole_kern.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ struct unplugged_pages {
283283
};
284284

285285
static DEFINE_MUTEX(plug_mem_mutex);
286-
static unsigned long long unplugged_pages_count = 0;
286+
static unsigned long long unplugged_pages_count;
287287
static LIST_HEAD(unplugged_pages);
288288
static int unplug_index = UNPLUGGED_PER_PAGE;
289289

@@ -846,13 +846,12 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1,
846846

847847
mconsole_notify(notify_socket, MCONSOLE_PANIC, message,
848848
strlen(message) + 1);
849-
return 0;
849+
return NOTIFY_DONE;
850850
}
851851

852852
static struct notifier_block panic_exit_notifier = {
853-
.notifier_call = notify_panic,
854-
.next = NULL,
855-
.priority = 1
853+
.notifier_call = notify_panic,
854+
.priority = INT_MAX, /* run as soon as possible */
856855
};
857856

858857
static int add_notifier(void)

arch/um/drivers/mmapper_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int __init mmapper_init(void)
122122
return 0;
123123
}
124124

125-
static void mmapper_exit(void)
125+
static void __exit mmapper_exit(void)
126126
{
127127
misc_deregister(&mmapper_dev);
128128
}

arch/um/drivers/net_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static void uml_net_poll_controller(struct net_device *dev)
265265
static void uml_net_get_drvinfo(struct net_device *dev,
266266
struct ethtool_drvinfo *info)
267267
{
268-
strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
268+
strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
269269
}
270270

271271
static const struct ethtool_ops uml_net_ethtool_ops = {

arch/um/drivers/ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static const struct tty_operations ssl_ops = {
106106
/* Changed by ssl_init and referenced by ssl_exit, which are both serialized
107107
* by being an initcall and exitcall, respectively.
108108
*/
109-
static int ssl_init_done = 0;
109+
static int ssl_init_done;
110110

111111
static void ssl_console_write(struct console *c, const char *string,
112112
unsigned len)

arch/um/drivers/stdio_console.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int con_remove(int n, char **error_out)
8888
}
8989

9090
/* Set in an initcall, checked in an exitcall */
91-
static int con_init_done = 0;
91+
static int con_init_done;
9292

9393
static int con_install(struct tty_driver *driver, struct tty_struct *tty)
9494
{

arch/um/drivers/ubd_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ static void do_io(struct io_thread_req *req, struct io_desc *desc)
15551555
int kernel_fd = -1;
15561556

15571557
/* Only changed by the io thread. XXX: currently unused. */
1558-
static int io_count = 0;
1558+
static int io_count;
15591559

15601560
int io_thread(void *arg)
15611561
{

arch/um/drivers/vector_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ static void vector_net_poll_controller(struct net_device *dev)
13721372
static void vector_net_get_drvinfo(struct net_device *dev,
13731373
struct ethtool_drvinfo *info)
13741374
{
1375-
strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
1375+
strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
13761376
}
13771377

13781378
static int vector_net_load_bpf_flash(struct net_device *dev,

arch/um/drivers/virt-pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ void *pci_root_bus_fwnode(struct pci_bus *bus)
857857
return um_pci_fwnode;
858858
}
859859

860-
static int um_pci_init(void)
860+
static int __init um_pci_init(void)
861861
{
862862
int err, i;
863863

@@ -940,7 +940,7 @@ static int um_pci_init(void)
940940
}
941941
module_init(um_pci_init);
942942

943-
static void um_pci_exit(void)
943+
static void __exit um_pci_exit(void)
944944
{
945945
unregister_virtio_driver(&um_pci_virtio_driver);
946946
irq_domain_remove(um_pci_msi_domain);

arch/um/drivers/virtio_uml.c

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -374,45 +374,48 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev,
374374
u8 extra_payload[512];
375375
} msg;
376376
int rc;
377+
irqreturn_t irq_rc = IRQ_NONE;
377378

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;
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+
}
397398
}
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);
398407
}
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);
411408

412-
if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY)
413-
vhost_user_reply(vu_dev, &msg.msg, response);
409+
if (ev && !vu_dev->suspended)
410+
time_travel_add_irq_event(ev);
414411

415-
return IRQ_HANDLED;
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;
416419
}
417420

418421
static irqreturn_t vu_req_interrupt(int irq, void *data)

arch/um/kernel/physmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ __uml_setup("iomem=", parse_iomem,
169169
);
170170

171171
/*
172-
* This list is constructed in parse_iomem and addresses filled in in
172+
* This list is constructed in parse_iomem and addresses filled in
173173
* setup_iomem, both of which run during early boot. Afterwards, it's
174174
* unchanged.
175175
*/

arch/um/kernel/um_arch.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
9696

9797
static void *c_start(struct seq_file *m, loff_t *pos)
9898
{
99-
return *pos < NR_CPUS ? cpu_data + *pos : NULL;
99+
return *pos < nr_cpu_ids ? cpu_data + *pos : NULL;
100100
}
101101

102102
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
@@ -132,7 +132,7 @@ static int have_root __initdata;
132132
static int have_console __initdata;
133133

134134
/* Set in uml_mem_setup and modified in linux_main */
135-
long long physmem_size = 32 * 1024 * 1024;
135+
long long physmem_size = 64 * 1024 * 1024;
136136
EXPORT_SYMBOL(physmem_size);
137137

138138
static const char *usage_string =
@@ -247,13 +247,13 @@ static int panic_exit(struct notifier_block *self, unsigned long unused1,
247247
bust_spinlocks(0);
248248
uml_exitcode = 1;
249249
os_dump_core();
250-
return 0;
250+
251+
return NOTIFY_DONE;
251252
}
252253

253254
static struct notifier_block panic_exit_notifier = {
254-
.notifier_call = panic_exit,
255-
.next = NULL,
256-
.priority = 0
255+
.notifier_call = panic_exit,
256+
.priority = INT_MAX - 1, /* run as 2nd notifier, won't return */
257257
};
258258

259259
void uml_finishsetup(void)
@@ -416,7 +416,7 @@ void __init setup_arch(char **cmdline_p)
416416
read_initrd();
417417

418418
paging_init();
419-
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
419+
strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
420420
*cmdline_p = command_line;
421421
setup_hostinfo(host_info, sizeof host_info);
422422

arch/um/kernel/umid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <os.h>
1010

1111
/* Changed by set_umid_arg */
12-
static int umid_inited = 0;
12+
static int umid_inited;
1313

1414
static int __init set_umid_arg(char *name, int *add)
1515
{

fs/hostfs/hostfs_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static char *__dentry_name(struct dentry *dentry, char *name)
103103
*/
104104
BUG_ON(p + strlen(p) + 1 != name + PATH_MAX);
105105

106-
strlcpy(name, root, PATH_MAX);
106+
strscpy(name, root, PATH_MAX);
107107
if (len > p - name) {
108108
__putname(name);
109109
return NULL;

0 commit comments

Comments
 (0)