public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi:ssif: compare block number correctly for multi-part return messages
@ 2019-04-24 11:50 Kamlakant Patel
  2019-04-24 13:53 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Kamlakant Patel @ 2019-04-24 11:50 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Kamlakant Patel, linux-kernel@vger.kernel.org,
	Jayachandran Chandrasekharan Nair,
	openipmi-developer@lists.sourceforge.net

According to ipmi spec, block number is a number that is incremented,
starting with 0, for each new block of message data returned using the
Middle transaction.

Here, the 'blocknum' is data[0] which always starts from zero(0) and
'ssif_info->multi_pos' starts from 1.
So, we need to add +1 to blocknum while comparing with multi_pos.

This change fixes ("ipmi:ssif: Fix handling of multi-part return
messages").

Reported-by: Kiran Kolukuluru <kirank@ami.com>
Signed-off-by: Kamlakant Patel <kamlakantp@marvell.com>
---
 drivers/char/ipmi/ipmi_ssif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 8b5aec5..2b03845 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -727,7 +727,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
 			/* End of read */
 			len = ssif_info->multi_len;
 			data = ssif_info->data;
-		} else if (blocknum != ssif_info->multi_pos) {
+		} else if (blocknum + 1 != ssif_info->multi_pos) {
 			/*
 			 * Out of sequence block, just abort.  Block
 			 * numbers start at zero for the second block,
-- 
1.8.3.1


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

* Re: [PATCH] ipmi:ssif: compare block number correctly for multi-part return messages
  2019-04-24 11:50 [PATCH] ipmi:ssif: compare block number correctly for multi-part return messages Kamlakant Patel
@ 2019-04-24 13:53 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2019-04-24 13:53 UTC (permalink / raw)
  To: Kamlakant Patel
  Cc: linux-kernel@vger.kernel.org, Jayachandran Chandrasekharan Nair,
	openipmi-developer@lists.sourceforge.net

On Wed, Apr 24, 2019 at 11:50:43AM +0000, Kamlakant Patel wrote:
> According to ipmi spec, block number is a number that is incremented,
> starting with 0, for each new block of message data returned using the
> Middle transaction.
> 
> Here, the 'blocknum' is data[0] which always starts from zero(0) and
> 'ssif_info->multi_pos' starts from 1.
> So, we need to add +1 to blocknum while comparing with multi_pos.

Indeed, I think you are right.  I hope there's no other hardware that
mis-interprets this like I did.  I'll need to fix my qemu simulation,
too.  The funny thing is, the comment is correct. Hmm.

I'll hand-apply this, as it has DOS newlines, too.

-corey

> 
> This change fixes ("ipmi:ssif: Fix handling of multi-part return
> messages").
> 
> Reported-by: Kiran Kolukuluru <kirank@ami.com>
> Signed-off-by: Kamlakant Patel <kamlakantp@marvell.com>
> ---
>  drivers/char/ipmi/ipmi_ssif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index 8b5aec5..2b03845 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -727,7 +727,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
>  			/* End of read */
>  			len = ssif_info->multi_len;
>  			data = ssif_info->data;
> -		} else if (blocknum != ssif_info->multi_pos) {
> +		} else if (blocknum + 1 != ssif_info->multi_pos) {
>  			/*
>  			 * Out of sequence block, just abort.  Block
>  			 * numbers start at zero for the second block,
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2019-04-24 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-24 11:50 [PATCH] ipmi:ssif: compare block number correctly for multi-part return messages Kamlakant Patel
2019-04-24 13:53 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox