diff options
| author | Rasmus Villemoes <[email protected]> | 2021-03-10 23:16:02 +0100 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2021-03-24 22:21:31 -0400 |
| commit | adb253433dc8bc8dd569ee03b233fed21afc1dc7 (patch) | |
| tree | 760d97300c56e13d75634b347d8a688e2d80b18f /tools/perf/scripts/python/event_analyzing_sample.py | |
| parent | be20b96b63197eb2e87ffa8973fadb194a16ee80 (diff) | |
scsi: bnx2i: Make bnx2i_process_iscsi_error() simpler and more robust
Instead of strcpy'ing into a stack buffer, just let additional_notice point
to a string literal living in .rodata. This is better in a few ways:
- Smaller .text - instead of gcc compiling the strcpys as a bunch of
immediate stores (effectively encoding the string literal in the
instruction stream), we only pay the price of storing the literal in
.rodata.
- Faster, because there's no string copying.
- Smaller stack usage (with my compiler, 72 bytes instead of 176 for the
sole caller, bnx2i_indicate_kcqe)
Moreover, it's currently possible for additional_notice[] to get used
uninitialized, so some random stack garbage would be passed to printk() -
in the worst case without any '\0' anywhere in those 64 bytes. That could
be fixed by initializing additional_notice[0], but the same is achieved
here by initializing the new pointer variable to "".
Also give the message pointer a similar treatment - there's no point making
temporary copies on the stack of those two strings.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/event_analyzing_sample.py')
0 files changed, 0 insertions, 0 deletions