From 588b6041267bd12227891881c2c78c8b73ae1024 Mon Sep 17 00:00:00 2001
From: John Klug <john.klug@multitech.com>
Date: Thu, 15 Oct 2020 11:23:45 -0500
Subject: Fix the length of the attributes for MTCAP

---
 io-module/mts-io.c        | 7 ++++---
 io-module/mts_io_module.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 0937342..0a511ff 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -667,7 +667,7 @@ mts_id_eeprom_load(void)
             ((tmp=HW_VERSION_MTCAP_0_2),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) ||
             ((tmp=HW_VERSION_MTCAP_0_3),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) {
 		current_blength = attr_blength = sizeof  mtcap_0_0_platform_attributes;
-        current_blength -= sizeof(struct attribute *);  /* Length without terminating NULL */
+		current_blength -= sizeof(struct attribute *);  /* Length without terminating NULL */
                 /* See if we have no radio, and if so, prune out the stuff that follows */
                 if(noradio) {
                     struct attribute **ap = mtcap_0_0_platform_attribute_group.attrs;
@@ -680,8 +680,9 @@ mts_id_eeprom_load(void)
                         if (is_radio_power_attr_mtcap(ap[j])) {
                             log_info("Pruning radio feature from mts-io",j);
                             ap[j] = NULL;
-                            current_blength = attr_blength = j * sizeof (ap[j]);
-							/* account for removed attributes in table length */
+                            current_blength = j * sizeof (ap[j]); /* Size without NULL */
+                            attr_blength += sizeof (ap[j]);  /* Size of attr array with NULL */
+                            /* account for removed attributes in table length */
                             break;
                         }
                     }
diff --git a/io-module/mts_io_module.h b/io-module/mts_io_module.h
index 4050432..220639d 100644
--- a/io-module/mts_io_module.h
+++ b/io-module/mts_io_module.h
@@ -5,7 +5,7 @@
  * MTAC cards.
  */
 
-#define DRIVER_VERSION  "v4.3.3a"
+#define DRIVER_VERSION  "v4.3.3b"
 #define DRIVER_AUTHOR   "Multitech Systems"
 #define DRIVER_DESC "MTS-IO Controller"
 #define DRIVER_NAME "mts-io"
-- 
cgit v1.2.3