mhvtl icon indicating copy to clipboard operation
mhvtl copied to clipboard

STK library serial number inquiry should not return trailing zero bytes

Open tomaz-beltram opened this issue 5 years ago • 1 comments

The change below fixes wrong vpd allocation of 18 bytes insted of 12.

diff --git a/usr/stklxx_pm.c b/usr/stklxx_pm.c
index 3f16e02..559b792 100644
--- a/usr/stklxx_pm.c
+++ b/usr/stklxx_pm.c
@@ -34,7 +34,7 @@ static void update_stk_l_vpd_80(struct lu_phy_attr *lu)
                *lu_vpd = NULL;
        }
 
-       *lu_vpd = alloc_vpd(0x12);
+       *lu_vpd = alloc_vpd(12);
        if (*lu_vpd) {
                d = (*lu_vpd)->data;
                /* d[4 - 15] Serial number of device */

tomaz-beltram avatar Nov 12 '19 14:11 tomaz-beltram

That looks off by one byte. The snprintf() after that can use 13 bytes

scsirob avatar Nov 29 '19 08:11 scsirob