Skip to content

Commit 2d65fc1

Browse files
btw616jmberg-intel
authored andcommitted
um: vector: Reduce stack usage in vector_eth_configure()
When compiling with clang (19.1.7), initializing *vp using a compound literal may result in excessive stack usage. Fix it by initializing the required fields of *vp individually. Without this patch: $ objdump -d arch/um/drivers/vector_kern.o | ./scripts/checkstack.pl x86_64 0 ... 0x0000000000000540 vector_eth_configure [vector_kern.o]:1472 ... With this patch: $ objdump -d arch/um/drivers/vector_kern.o | ./scripts/checkstack.pl x86_64 0 ... 0x0000000000000540 vector_eth_configure [vector_kern.o]:208 ... Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Tiwei Bie <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 8948941 commit 2d65fc1

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

arch/um/drivers/vector_kern.c

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,35 +1625,19 @@ static void vector_eth_configure(
16251625

16261626
device->dev = dev;
16271627

1628-
*vp = ((struct vector_private)
1629-
{
1630-
.list = LIST_HEAD_INIT(vp->list),
1631-
.dev = dev,
1632-
.unit = n,
1633-
.options = get_transport_options(def),
1634-
.rx_irq = 0,
1635-
.tx_irq = 0,
1636-
.parsed = def,
1637-
.max_packet = get_mtu(def) + ETH_HEADER_OTHER,
1638-
/* TODO - we need to calculate headroom so that ip header
1639-
* is 16 byte aligned all the time
1640-
*/
1641-
.headroom = get_headroom(def),
1642-
.form_header = NULL,
1643-
.verify_header = NULL,
1644-
.header_rxbuffer = NULL,
1645-
.header_txbuffer = NULL,
1646-
.header_size = 0,
1647-
.rx_header_size = 0,
1648-
.rexmit_scheduled = false,
1649-
.opened = false,
1650-
.transport_data = NULL,
1651-
.in_write_poll = false,
1652-
.coalesce = 2,
1653-
.req_size = get_req_size(def),
1654-
.in_error = false,
1655-
.bpf = NULL
1656-
});
1628+
INIT_LIST_HEAD(&vp->list);
1629+
vp->dev = dev;
1630+
vp->unit = n;
1631+
vp->options = get_transport_options(def);
1632+
vp->parsed = def;
1633+
vp->max_packet = get_mtu(def) + ETH_HEADER_OTHER;
1634+
/*
1635+
* TODO - we need to calculate headroom so that ip header
1636+
* is 16 byte aligned all the time
1637+
*/
1638+
vp->headroom = get_headroom(def);
1639+
vp->coalesce = 2;
1640+
vp->req_size = get_req_size(def);
16571641

16581642
dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST);
16591643
INIT_WORK(&vp->reset_tx, vector_reset_tx);

0 commit comments

Comments
 (0)