diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-08-14 01:12:45 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-14 06:45:49 +0300 |
commit | 1bbf3aed25e0fc256e825da1f5c45d7b4daa828e (patch) | |
tree | 785d4d7d59822490c0709d379954e3dba35729f1 /drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | |
parent | cf87615d15f37182b2a3a4cd722288d3d5956900 (diff) | |
download | linux-1bbf3aed25e0fc256e825da1f5c45d7b4daa828e.tar.xz |
bnxt_en: take coredump_record structure off stack
The bnxt_coredump_record structure is very long, causing a warning
about possible stack overflow on 32-bit architectures:
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c: In function 'bnxt_get_coredump':
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2989:1: error: the frame size of 1188 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
I could not see any reason to operate on an on-stack copy of the
structure before copying it back into the caller-provided buffer, which
also simplifies the code here.
Fixes: 6c5657d085ae ("bnxt_en: Add support for ethtool get dump.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 539be1d1b67f..e52d7af3ab3e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2900,7 +2900,6 @@ static int bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len) struct coredump_segment_record *seg_record = NULL; u32 offset = 0, seg_hdr_len, seg_record_len; struct bnxt_coredump_segment_hdr seg_hdr; - struct bnxt_coredump_record coredump_rec; struct bnxt_coredump coredump = {NULL}; time64_t start_time; u16 start_utc; @@ -2976,14 +2975,12 @@ next_seg: } err: - if (buf) { - bnxt_fill_coredump_record(bp, &coredump_rec, start_time, + if (buf) + bnxt_fill_coredump_record(bp, buf + offset, start_time, start_utc, coredump.total_segs + 1, rc); - memcpy(buf + offset, &coredump_rec, sizeof(coredump_rec)); - } kfree(coredump.data); - *dump_len += sizeof(coredump_rec); + *dump_len += sizeof(struct bnxt_coredump_record); return rc; } |