From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
<intel-wired-lan@lists.osuosl.org>
Cc: netdev@vger.kernel.org, Simon Horman <horms@kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v3 1/3] ice: ice_aq_check_events: fix off-by-one check when filling buffer
Date: Tue, 8 Aug 2023 11:06:37 -0700 [thread overview]
Message-ID: <9dc74634-9c06-de5a-b1d8-537943c29e86@intel.com> (raw)
In-Reply-To: <20230807155848.90907-2-przemyslaw.kitszel@intel.com>
On 8/7/2023 8:58 AM, Przemek Kitszel wrote:
> Allow task's event buffer to be filled also in the case that it's size
> is exactly the size of the message.
>
> Fixes: d69ea414c9b4 ("ice: implement device flash update via devlink")
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_main.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index a73895483e6c..f2ad2153589a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -1357,7 +1357,9 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
> static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,
> struct ice_rq_event_info *event)
> {
> + struct ice_rq_event_info *task_ev;
> struct ice_aq_task *task;
> +
Accidental newline?
> bool found = false;
>
> spin_lock_bh(&pf->aq_wait_lock);
> @@ -1365,15 +1367,15 @@ static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,
> if (task->state || task->opcode != opcode)
> continue;
>
> - memcpy(&task->event->desc, &event->desc, sizeof(event->desc));
> - task->event->msg_len = event->msg_len;
> + task_ev = task->event;
> + memcpy(&task_ev->desc, &event->desc, sizeof(event->desc));
> + task_ev->msg_len = event->msg_len;
>
> /* Only copy the data buffer if a destination was set */
> - if (task->event->msg_buf &&
> - task->event->buf_len > event->buf_len) {
> - memcpy(task->event->msg_buf, event->msg_buf,
> + if (task_ev->msg_buf && task_ev->buf_len >= event->buf_len) {
> + memcpy(task_ev->msg_buf, event->msg_buf,
> event->buf_len);
> - task->event->buf_len = event->buf_len;
> + task_ev->buf_len = event->buf_len;
> }
>
> task->state = ICE_AQ_TASK_COMPLETE;
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-08-08 18:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 15:58 [Intel-wired-lan] [PATCH iwl-next v3 0/3] ice: split ice_aq_wait_for_event() func into two Przemek Kitszel
2023-08-07 15:58 ` [Intel-wired-lan] [PATCH iwl-next v3 1/3] ice: ice_aq_check_events: fix off-by-one check when filling buffer Przemek Kitszel
2023-08-08 18:06 ` Tony Nguyen [this message]
2023-08-08 21:14 ` Przemek Kitszel
2023-08-07 15:58 ` [Intel-wired-lan] [PATCH iwl-next v3 2/3] ice: embed &ice_rq_event_info event into struct ice_aq_task Przemek Kitszel
2023-08-08 18:06 ` Tony Nguyen
2023-08-07 15:58 ` [Intel-wired-lan] [PATCH iwl-next v3 3/3] ice: split ice_aq_wait_for_event() func into two Przemek Kitszel
2023-08-07 16:45 ` [Intel-wired-lan] [PATCH iwl-next v3 0/3] " Keller, Jacob E
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=9dc74634-9c06-de5a-b1d8-537943c29e86@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.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