linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Seo <james@equiv.tech>
To: Kees Cook <keescook@chromium.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Suganath Prabu Subramani  <suganath-prabu.subramani@broadcom.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] scsi: mpt3sas: Replace a dynamic allocation with a local variable
Date: Sat, 29 Jul 2023 01:35:15 -0700	[thread overview]
Message-ID: <ZMTPQ9c0hmVBapxe@equiv.tech> (raw)
In-Reply-To: <202307281528.086CF1D063@keescook>

On Fri, Jul 28, 2023 at 03:29:17PM -0700, Kees Cook wrote:
> On Tue, Jul 25, 2023 at 09:13:31AM -0700, James Seo wrote:
>> This dynamic allocation can be replaced with a local variable.
>> 
>> Signed-off-by: James Seo <james@equiv.tech>
>> ---
>>  drivers/scsi/mpt3sas/mpt3sas_base.c | 19 +++++--------------
>>  1 file changed, 5 insertions(+), 14 deletions(-)
>> 
>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> index cd6f36094159..a32a6fa728a7 100644
>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> @@ -5361,10 +5361,9 @@ _base_update_diag_trigger_pages(struct MPT3SAS_ADAPTER *ioc)
>>  static int _base_assign_fw_reported_qd(struct MPT3SAS_ADAPTER *ioc)
>>  {
>>  	Mpi2ConfigReply_t mpi_reply;
>> -	Mpi2SasIOUnitPage1_t *sas_iounit_pg1 = NULL;
>> +	Mpi2SasIOUnitPage1_t sas_iounit_pg1;
>>  	Mpi26PCIeIOUnitPage1_t pcie_iounit_pg1;
>>  	u16 depth;
>> -	int sz;
>>  	int rc = 0;
>>  
>>  	ioc->max_wideport_qd = MPT3SAS_SAS_QUEUE_DEPTH;
>> @@ -5374,28 +5373,21 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS_ADAPTER *ioc)
>>  	if (!ioc->is_gen35_ioc)
>>  		goto out;
>>  	/* sas iounit page 1 */
>> -	sz = offsetof(Mpi2SasIOUnitPage1_t, PhyData);
>> -	sas_iounit_pg1 = kzalloc(sizeof(Mpi2SasIOUnitPage1_t), GFP_KERNEL);
> 
> Hunh. So Mpi2SasIOUnitPage1_t is used without the flexarray at all?
> 
> -Kees

You call it "dead code" and "unused struct members".
mpt3sas evidently calls it "documentation" ;)

Anyway, does this commit get your "Reviewed-by:"?

James


      reply	other threads:[~2023-07-29  8:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 16:13 [PATCH 0/6] scsi: mpt3sas: Use flexible arrays and do a few cleanups James Seo
2023-07-25 16:13 ` [PATCH 1/6] scsi: mpt3sas: Use flexible arrays when obviously possible James Seo
2023-07-28 22:01   ` Kees Cook
2023-07-25 16:13 ` [PATCH 2/6] scsi: mpt3sas: Use flexible arrays when less " James Seo
2023-07-28 22:26   ` Kees Cook
2023-07-29  8:09     ` James Seo
2023-07-25 16:13 ` [PATCH 3/6] scsi: mpt3sas: Use struct_size() for struct size calculations James Seo
2023-07-25 16:13 ` [PATCH 4/6] scsi: mpt3sas: Fix an outdated comment James Seo
2023-07-28 22:27   ` Kees Cook
2023-07-25 16:13 ` [PATCH 5/6] scsi: mpt3sas: Fix typo of "TRIGGER" James Seo
2023-07-28 22:27   ` Kees Cook
2023-07-25 16:13 ` [PATCH 6/6] scsi: mpt3sas: Replace a dynamic allocation with a local variable James Seo
2023-07-28 22:29   ` Kees Cook
2023-07-29  8:35     ` James Seo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMTPQ9c0hmVBapxe@equiv.tech \
    --to=james@equiv.tech \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=gustavoars@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).