Skip to content

Commit 46ec762

Browse files
btw616gregkh
authored andcommitted
um: vector: Reduce stack usage in vector_eth_configure()
[ Upstream commit 2d65fc13be85c336c56af7077f08ccd3a3a15a4a ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent d104a84 commit 46ec762

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
@@ -1600,35 +1600,19 @@ static void vector_eth_configure(
16001600

16011601
device->dev = dev;
16021602

1603-
*vp = ((struct vector_private)
1604-
{
1605-
.list = LIST_HEAD_INIT(vp->list),
1606-
.dev = dev,
1607-
.unit = n,
1608-
.options = get_transport_options(def),
1609-
.rx_irq = 0,
1610-
.tx_irq = 0,
1611-
.parsed = def,
1612-
.max_packet = get_mtu(def) + ETH_HEADER_OTHER,
1613-
/* TODO - we need to calculate headroom so that ip header
1614-
* is 16 byte aligned all the time
1615-
*/
1616-
.headroom = get_headroom(def),
1617-
.form_header = NULL,
1618-
.verify_header = NULL,
1619-
.header_rxbuffer = NULL,
1620-
.header_txbuffer = NULL,
1621-
.header_size = 0,
1622-
.rx_header_size = 0,
1623-
.rexmit_scheduled = false,
1624-
.opened = false,
1625-
.transport_data = NULL,
1626-
.in_write_poll = false,
1627-
.coalesce = 2,
1628-
.req_size = get_req_size(def),
1629-
.in_error = false,
1630-
.bpf = NULL
1631-
});
1603+
INIT_LIST_HEAD(&vp->list);
1604+
vp->dev = dev;
1605+
vp->unit = n;
1606+
vp->options = get_transport_options(def);
1607+
vp->parsed = def;
1608+
vp->max_packet = get_mtu(def) + ETH_HEADER_OTHER;
1609+
/*
1610+
* TODO - we need to calculate headroom so that ip header
1611+
* is 16 byte aligned all the time
1612+
*/
1613+
vp->headroom = get_headroom(def);
1614+
vp->coalesce = 2;
1615+
vp->req_size = get_req_size(def);
16321616

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

0 commit comments

Comments
 (0)