linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qedi: remove declaration of nvm_image from stack
@ 2019-03-27 18:11 Colin King
  2019-03-28  5:53 ` Manish Rangankar
  2019-03-29 14:04 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-03-27 18:11 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The nvm_image is a large struct qedi_nvm_iscsi_image object of
over 24K so don't declare it on the stack just for a sizeof
requirement; use sizeof on struct qedi_nvm_iscsi_image instead.

Fixes: c77a2fa3ff8f ("scsi: qedi: Add the CRC size within iSCSI NVM image")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qedi/qedi_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index e74a62448ba4..e5db9a9954dc 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1392,10 +1392,8 @@ static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi)
 
 static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
 {
-	struct qedi_nvm_iscsi_image nvm_image;
-
 	qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
-					       sizeof(nvm_image),
+					       sizeof(struct qedi_nvm_iscsi_image),
 					       &qedi->nvm_buf_dma, GFP_KERNEL);
 	if (!qedi->iscsi_image) {
 		QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
@@ -2236,14 +2234,13 @@ static void qedi_boot_release(void *data)
 static int qedi_get_boot_info(struct qedi_ctx *qedi)
 {
 	int ret = 1;
-	struct qedi_nvm_iscsi_image nvm_image;
 
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
 		  "Get NVM iSCSI CFG image\n");
 	ret = qedi_ops->common->nvm_get_image(qedi->cdev,
 					      QED_NVM_IMAGE_ISCSI_CFG,
 					      (char *)qedi->iscsi_image,
-					      sizeof(nvm_image));
+					      sizeof(struct qedi_nvm_iscsi_image));
 	if (ret)
 		QEDI_ERR(&qedi->dbg_ctx,
 			 "Could not get NVM image. ret = %d\n", ret);
-- 
2.20.1


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

* RE: [PATCH] scsi: qedi: remove declaration of nvm_image from stack
  2019-03-27 18:11 [PATCH] scsi: qedi: remove declaration of nvm_image from stack Colin King
@ 2019-03-28  5:53 ` Manish Rangankar
  2019-03-29 14:04 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Manish Rangankar @ 2019-03-28  5:53 UTC (permalink / raw)
  To: Colin King, QLogic-Storage-Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel


> -----Original Message-----
> From: Colin King <colin.king@canonical.com>
> Sent: Wednesday, March 27, 2019 11:41 PM
> To: QLogic-Storage-Upstream@cavium.com; James E . J . Bottomley
> <jejb@linux.ibm.com>; Martin K . Petersen <martin.petersen@oracle.com>;
> linux-scsi@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] scsi: qedi: remove declaration of nvm_image from stack
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The nvm_image is a large struct qedi_nvm_iscsi_image object of over 24K
> so don't declare it on the stack just for a sizeof requirement; use sizeof on
> struct qedi_nvm_iscsi_image instead.
> 
> Fixes: c77a2fa3ff8f ("scsi: qedi: Add the CRC size within iSCSI NVM image")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/qedi/qedi_main.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
> index e74a62448ba4..e5db9a9954dc 100644
> --- a/drivers/scsi/qedi/qedi_main.c
> +++ b/drivers/scsi/qedi/qedi_main.c
> @@ -1392,10 +1392,8 @@ static void qedi_free_nvm_iscsi_cfg(struct
> qedi_ctx *qedi)
> 
>  static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)  {
> -	struct qedi_nvm_iscsi_image nvm_image;
> -
>  	qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
> -					       sizeof(nvm_image),
> +					       sizeof(struct
> qedi_nvm_iscsi_image),
>  					       &qedi->nvm_buf_dma,
> GFP_KERNEL);
>  	if (!qedi->iscsi_image) {
>  		QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM
> BUF.\n"); @@ -2236,14 +2234,13 @@ static void qedi_boot_release(void
> *data)  static int qedi_get_boot_info(struct qedi_ctx *qedi)  {
>  	int ret = 1;
> -	struct qedi_nvm_iscsi_image nvm_image;
> 
>  	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
>  		  "Get NVM iSCSI CFG image\n");
>  	ret = qedi_ops->common->nvm_get_image(qedi->cdev,
>  					      QED_NVM_IMAGE_ISCSI_CFG,
>  					      (char *)qedi->iscsi_image,
> -					      sizeof(nvm_image));
> +					      sizeof(struct
> qedi_nvm_iscsi_image));
>  	if (ret)
>  		QEDI_ERR(&qedi->dbg_ctx,
>  			 "Could not get NVM image. ret = %d\n", ret);
> --
> 2.20.1

Thanks,
Acked-by: Manish Rangankar <mrangankar@marvell.com>

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

* Re: [PATCH] scsi: qedi: remove declaration of nvm_image from stack
  2019-03-27 18:11 [PATCH] scsi: qedi: remove declaration of nvm_image from stack Colin King
  2019-03-28  5:53 ` Manish Rangankar
@ 2019-03-29 14:04 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-03-29 14:04 UTC (permalink / raw)
  To: Colin King
  Cc: QLogic-Storage-Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, kernel-janitors, linux-kernel


Colin,

> The nvm_image is a large struct qedi_nvm_iscsi_image object of over
> 24K so don't declare it on the stack just for a sizeof requirement;
> use sizeof on struct qedi_nvm_iscsi_image instead.

Applied to 5.1/scsi-fixes. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-03-29 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 18:11 [PATCH] scsi: qedi: remove declaration of nvm_image from stack Colin King
2019-03-28  5:53 ` Manish Rangankar
2019-03-29 14:04 ` 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).