All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: leon@kernel.org, intel-wired-lan@lists.osuosl.org,
	jesse.brandeburg@intel.com, linux-kernel@vger.kernel.org,
	edumazet@google.com, anthony.l.nguyen@intel.com,
	netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
	davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH net v2] ice: Add check for kzalloc
Date: Thu, 8 Dec 2022 12:17:59 +0100	[thread overview]
Message-ID: <Y5HH54ek3KX2aHpI@nanopsycho> (raw)
In-Reply-To: <20221208100603.29588-1-jiasheng@iscas.ac.cn>

Thu, Dec 08, 2022 at 11:06:03AM CET, jiasheng@iscas.ac.cn wrote:
>On Thu, Dec 08, 2022 at 05:25:02PM +0800, Leon Romanovsky wrote:
>>> +err_out:
>>> +	for (j = 0; j < i; j++) {
>> 
>> You don't need an extra variable, "while(i--)" will do the trick.
>
>No, the right range is [0, i - 1], but the "while(i--)" is [1, i].

Are you sure??


>If using "while(i--)", the code should be "tty_port_destroy(pf->gnss_tty_port[i - 1]);".
>It will be more complex.
>Therefore, it is worthwhile to use an extra varaible.
>
>Thanks,
>Jiang
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Pirko <jiri@resnulli.us>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: leon@kernel.org, jesse.brandeburg@intel.com,
	anthony.l.nguyen@intel.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] ice: Add check for kzalloc
Date: Thu, 8 Dec 2022 12:17:59 +0100	[thread overview]
Message-ID: <Y5HH54ek3KX2aHpI@nanopsycho> (raw)
In-Reply-To: <20221208100603.29588-1-jiasheng@iscas.ac.cn>

Thu, Dec 08, 2022 at 11:06:03AM CET, jiasheng@iscas.ac.cn wrote:
>On Thu, Dec 08, 2022 at 05:25:02PM +0800, Leon Romanovsky wrote:
>>> +err_out:
>>> +	for (j = 0; j < i; j++) {
>> 
>> You don't need an extra variable, "while(i--)" will do the trick.
>
>No, the right range is [0, i - 1], but the "while(i--)" is [1, i].

Are you sure??


>If using "while(i--)", the code should be "tty_port_destroy(pf->gnss_tty_port[i - 1]);".
>It will be more complex.
>Therefore, it is worthwhile to use an extra varaible.
>
>Thanks,
>Jiang
>

  reply	other threads:[~2022-12-08 11:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 10:06 [Intel-wired-lan] [PATCH net v2] ice: Add check for kzalloc Jiasheng Jiang
2022-12-08 10:06 ` Jiasheng Jiang
2022-12-08 11:17 ` Jiri Pirko [this message]
2022-12-08 11:17   ` Jiri Pirko
  -- strict thread matches above, loose matches on Subject: below --
2022-12-08 12:52 [Intel-wired-lan] " Jiasheng Jiang
2022-12-08  1:19 Jiasheng Jiang
2022-12-08  9:24 ` Leon Romanovsky

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=Y5HH54ek3KX2aHpI@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.