Discussion:
[Libstoragemgmt-devel] [PATCH] C API: Fix capability setting
Tony Asleson
2014-08-01 15:42:25 UTC
Permalink
We were off by one and stepping past the end. This isn't the
first time I've done this. May need to remove function as
it's prone to be used incorrectly.

Signed-off-by: Tony Asleson <***@redhat.com>
---
plugin/simc/simc_lsmplugin.c | 3 +--
test/tester.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index ddc9b1c..b39d7ed 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -334,7 +334,7 @@ static int cap(lsm_plugin_ptr c, lsm_system *system,
*cap = lsm_capability_record_alloc(NULL);

if( *cap ) {
- rc = lsm_capability_set_n(*cap, LSM_CAPABILITY_SUPPORTED, 44,
+ rc = lsm_capability_set_n(*cap, LSM_CAPABILITY_SUPPORTED, 43,
LSM_CAP_VOLUMES,
LSM_CAP_VOLUME_CREATE,
LSM_CAP_VOLUME_RESIZE,
@@ -354,7 +354,6 @@ static int cap(lsm_plugin_ptr c, lsm_system *system,
LSM_CAP_VOLUME_UNMASK,
LSM_CAP_ACCESS_GROUPS,
LSM_CAP_ACCESS_GROUP_CREATE_WWPN,
- LSM_CAP_ACCESS_GROUP_CREATE_WWPN,
LSM_CAP_ACCESS_GROUP_INITIATOR_ADD_WWPN,
LSM_CAP_ACCESS_GROUP_INITIATOR_DELETE,
LSM_CAP_VOLUMES_ACCESSIBLE_BY_ACCESS_GROUP,
diff --git a/test/tester.c b/test/tester.c
index 8d56386..e0f09aa 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -2125,7 +2125,7 @@ START_TEST(test_capability)
fail_unless(cap != NULL);

if( cap ) {
- G(rc, lsm_capability_set_n, cap, LSM_CAPABILITY_SUPPORTED, 44,
+ G(rc, lsm_capability_set_n, cap, LSM_CAPABILITY_SUPPORTED, 43,
LSM_CAP_VOLUMES,
LSM_CAP_VOLUME_CREATE,
LSM_CAP_VOLUME_RESIZE,
--
1.8.2.1
Christophe Fergeau
2014-08-01 17:55:07 UTC
Permalink
Hey,
Post by Tony Asleson
We were off by one and stepping past the end. This isn't the
first time I've done this. May need to remove function as
it's prone to be used incorrectly.
Tony Asleson
2014-08-01 18:55:09 UTC
Permalink
Hey,
Post by Tony Asleson
We were off by one and stepping past the end. This isn't the
first time I've done this. May need to remove function as
it's prone to be used incorrectly.
Loading...