linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: aic79xx: Use __ro_after_init explicitly
@ 2022-09-14 11:59 Kees Cook
  2022-09-16  2:02 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2022-09-14 11:59 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Kees Cook, David Malcolm, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, linux-hardening

ahd_linux_setup_iocell_info() intentionally writes to the const-marked
aic79xx_iocell_info array, but is called during __init, so the location
is actually writable at this point on most architectures. Annotate this
explicitly with __ro_after_init to avoid static analysis confusion.

Reported-by: David Malcolm <dmalcolm@redhat.com>
Link: https://lpc.events/event/16/contributions/1175/attachments/1109/2128/2022-LPC-analyzer-talk.pdf
Cc: Hannes Reinecke <hare@suse.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/scsi/aic7xxx/aic79xx_osm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 928099163f0f..f2f3405cdec5 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -194,7 +194,7 @@ struct ahd_linux_iocell_opts
 #define AIC79XX_PRECOMP_INDEX	0
 #define AIC79XX_SLEWRATE_INDEX	1
 #define AIC79XX_AMPLITUDE_INDEX	2
-static const struct ahd_linux_iocell_opts aic79xx_iocell_info[] =
+static struct ahd_linux_iocell_opts aic79xx_iocell_info[] __ro_after_init =
 {
 	AIC79XX_DEFAULT_IOOPTS,
 	AIC79XX_DEFAULT_IOOPTS,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: aic79xx: Use __ro_after_init explicitly
  2022-09-14 11:59 [PATCH] scsi: aic79xx: Use __ro_after_init explicitly Kees Cook
@ 2022-09-16  2:02 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2022-09-16  2:02 UTC (permalink / raw)
  To: Kees Cook
  Cc: Hannes Reinecke, David Malcolm, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, linux-hardening


Kees,

> ahd_linux_setup_iocell_info() intentionally writes to the const-marked
> aic79xx_iocell_info array, but is called during __init, so the
> location is actually writable at this point on most
> architectures. Annotate this explicitly with __ro_after_init to avoid
> static analysis confusion.

Applied to 6.1/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-16  2:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 11:59 [PATCH] scsi: aic79xx: Use __ro_after_init explicitly Kees Cook
2022-09-16  2:02 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).