If the 'cmi->cmi_opts' has only one option and there is no any
comma in it, when removing the 'mon_addr' it will fail. And will
pass the 'mon_addr' option to the old kernels.
Fixes: https://tracker.ceph.com/issues/58018
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit
3180332ec48596794e2ff4fff305119c4ec2caf7)
memmove(key_start, value_end, len2);
} else {
/* last kv pair - swallow the comma */
- --key_start;
+ if (*(key_start - 1) == ',') {
+ --key_start;
+ }
*key_start = '\0';
}