summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs/ufshcd.h
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2021-03-10 23:16:02 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2021-03-24 22:21:31 -0400
commitadb253433dc8bc8dd569ee03b233fed21afc1dc7 (patch)
tree760d97300c56e13d75634b347d8a688e2d80b18f /drivers/scsi/ufs/ufshcd.h
parentbe20b96b63197eb2e87ffa8973fadb194a16ee80 (diff)
downloadlwn-adb253433dc8bc8dd569ee03b233fed21afc1dc7.tar.gz
lwn-adb253433dc8bc8dd569ee03b233fed21afc1dc7.zip
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/20210310221602.2494422-1-linux@rasmusvillemoes.dk Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.h')
0 files changed, 0 insertions, 0 deletions