Skip to contentSkip to conversation

ntb_hw_switchtec: Fix ntb_mw_clear_trans returning error if size == 0

PATCH RESEND In review Alexander Fomichev 2 participants 5 messages Jul 10, 2019 – Mar 13, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ntb_hw_switchtec: Fix ntb_mw_clear_trans returning error if size == 0

ntb_mw_set_trans should work as ntb_mw_clear_trans when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans working.

---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
index 1e2f627d3bac..19d46af19650 100644
@@ -299,7 +299,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
 	if (widx >= switchtec_ntb_mw_count(ntb, pidx))
 		return -EINVAL;
 
-	if (xlate_pos < 12)
+	if (size != 0 && xlate_pos < 12)
 		return -EINVAL;
 
 	if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
Signature · 1 line
2.17.1
#1 lore raw

Somehow this patch was lost. The problem is still actual. Please, add to upstream.

Quoted 25 lines · Alexander Fomichev

ntb_mw_set_trans should work as ntb_mw_clear_trans when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans working.

---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
index 1e2f627d3bac..19d46af19650 100644
@@ -299,7 +299,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
 	if (widx >= switchtec_ntb_mw_count(ntb, pidx))
 		return -EINVAL;
 
-	if (xlate_pos < 12)
+	if (size != 0 && xlate_pos < 12)
 		return -EINVAL;
 
 	if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
Signature · 1 line
2.17.1
Signature · 2 lines
Regards,
  Alexander
#2 lore raw

Ping?

CC Jon Mason <[email protected]>
CC Dave Jiang <[email protected]>
CC Allen Hubbe <[email protected]>
CC Kurt Schwemmer <[email protected]>
CC Logan Gunthorpe <[email protected]>
Quoted 33 lines · Alexander Fomichev

Somehow this patch was lost. The problem is still actual. Please, add to upstream.

Quoted 25 lines · Alexander Fomichev

ntb_mw_set_trans should work as ntb_mw_clear_trans when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans working.

---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -1
index 1e2f627d3bac..19d46af19650 100644
@@ -299,7 +299,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
 	if (widx >= switchtec_ntb_mw_count(ntb, pidx))
 		return -EINVAL;
 
-	if (xlate_pos < 12)
+	if (size != 0 && xlate_pos < 12)
 		return -EINVAL;
 
 	if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
Signature · 1 line
2.17.1
Signature · 2 lines
Regards,
  Alexander
maintainer
#3 lore raw
Quoted 2 lines · Alexander Fomichev

Ping?

Sorry, I missed this somehow :(

I just pulled it in and it should be in my github tree in the next hour or so.

Thanks,
Jon

Quoted 41 lines
CC Jon Mason <[email protected]>
CC Dave Jiang <[email protected]>
CC Allen Hubbe <[email protected]>
CC Kurt Schwemmer <[email protected]>
CC Logan Gunthorpe <[email protected]>
Quoted 33 lines · Alexander Fomichev

Somehow this patch was lost. The problem is still actual. Please, add to upstream.

Quoted 24 lines · Alexander Fomichev

ntb_mw_set_trans should work as ntb_mw_clear_trans when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans working.

---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -2
index 1e2f627d3bac..19d46af19650 100644
@@ -299,7 +299,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
    if (widx >= switchtec_ntb_mw_count(ntb, pidx))
            return -EINVAL;
 
-   if (xlate_pos < 12)
+   if (size != 0 && xlate_pos < 12)
            return -EINVAL;
 
    if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
--
Quoted 1 line

2.17.1

--
Regards,
Alexander

#4 lore raw

Thank you very much.

Regards,
Alexander.

Quoted 52 lines · Jon Mason
Quoted 2 lines · Alexander Fomichev

Ping?

Sorry, I missed this somehow :(

I just pulled it in and it should be in my github tree in the next hour or so.

Thanks,
Jon

Quoted 41 lines
CC Jon Mason <[email protected]>
CC Dave Jiang <[email protected]>
CC Allen Hubbe <[email protected]>
CC Kurt Schwemmer <[email protected]>
CC Logan Gunthorpe <[email protected]>
Quoted 33 lines · Alexander Fomichev

Somehow this patch was lost. The problem is still actual. Please, add to upstream.

Quoted 24 lines · Alexander Fomichev

ntb_mw_set_trans should work as ntb_mw_clear_trans when size == 0 and/or addr == 0. But error in xlate_pos checking condition prevents this. Fix the condition to make ntb_mw_clear_trans working.

---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -2
index 1e2f627d3bac..19d46af19650 100644
@@ -299,7 +299,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
    if (widx >= switchtec_ntb_mw_count(ntb, pidx))
            return -EINVAL;
 
-   if (xlate_pos < 12)
+   if (size != 0 && xlate_pos < 12)
            return -EINVAL;
 
    if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
--
Quoted 1 line

2.17.1

--
Regards,
Alexander

Signature · 2 lines
Regards,
  Alexander