As cmsg.raid_slot is le32, comparing for >0 is not meaningful.
So introduce cpu-endian 'raid_slot' and only assign to cmsg.raid_slot
when we know value is valid.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
struct cluster_msg cmsg;
struct md_rdev *rdev;
int ret = 0;
struct cluster_msg cmsg;
struct md_rdev *rdev;
int ret = 0;
memset(&cmsg, 0, sizeof(cmsg));
cmsg.type = cpu_to_le32(METADATA_UPDATED);
memset(&cmsg, 0, sizeof(cmsg));
cmsg.type = cpu_to_le32(METADATA_UPDATED);
/* Pick up a good active device number to send.
*/
rdev_for_each(rdev, mddev)
if (rdev->raid_disk > -1 && !test_bit(Faulty, &rdev->flags)) {
/* Pick up a good active device number to send.
*/
rdev_for_each(rdev, mddev)
if (rdev->raid_disk > -1 && !test_bit(Faulty, &rdev->flags)) {
- cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
+ raid_slot = rdev->desc_nr;
- if (cmsg.raid_slot >= 0)
+ if (raid_slot >= 0) {
+ cmsg.raid_slot = cpu_to_le32(raid_slot);
ret = __sendmsg(cinfo, &cmsg);
ret = __sendmsg(cinfo, &cmsg);
pr_warn("md-cluster: No good device id found to send\n");
unlock_comm(cinfo);
return ret;
pr_warn("md-cluster: No good device id found to send\n");
unlock_comm(cinfo);
return ret;