ice: ice_aq_check_events: fix off-by-one check when filling buffer
[ Upstream commit e1e8a142c43336e3d25bfa1cb3a4ae7d00875c48 ]
Allow task's event buffer to be filled also in the case that it's size
is exactly the size of the message.
Fixes: d69ea414c9 ("ice: implement device flash update via devlink")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0f50641222
commit
841d2fffd0
1 changed files with 7 additions and 6 deletions
|
|
@ -1356,6 +1356,7 @@ 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,
|
static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,
|
||||||
struct ice_rq_event_info *event)
|
struct ice_rq_event_info *event)
|
||||||
{
|
{
|
||||||
|
struct ice_rq_event_info *task_ev;
|
||||||
struct ice_aq_task *task;
|
struct ice_aq_task *task;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
|
@ -1364,15 +1365,15 @@ static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,
|
||||||
if (task->state || task->opcode != opcode)
|
if (task->state || task->opcode != opcode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memcpy(&task->event->desc, &event->desc, sizeof(event->desc));
|
task_ev = task->event;
|
||||||
task->event->msg_len = event->msg_len;
|
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 */
|
/* Only copy the data buffer if a destination was set */
|
||||||
if (task->event->msg_buf &&
|
if (task_ev->msg_buf && task_ev->buf_len >= event->buf_len) {
|
||||||
task->event->buf_len > event->buf_len) {
|
memcpy(task_ev->msg_buf, event->msg_buf,
|
||||||
memcpy(task->event->msg_buf, event->msg_buf,
|
|
||||||
event->buf_len);
|
event->buf_len);
|
||||||
task->event->buf_len = event->buf_len;
|
task_ev->buf_len = event->buf_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
task->state = ICE_AQ_TASK_COMPLETE;
|
task->state = ICE_AQ_TASK_COMPLETE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue