Skip to contentSkip to conversation

drivers: staging/lustre: lmv_obd.c - suppress Sparse user cast warning

PATCH New Michael Sartain 2 participants 2 messages Jun 7, 2017 – Jun 13, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: staging/lustre: lmv_obd.c - suppress Sparse user cast warning

Comment above assignment states that uarg does not point to user space memory (ll_dir_ioctl does copy_from_user), so this is a valid cast. This patch adds a __force annotation to suppress the "cast removes address space of expression" Sparse warning.

---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
index 271e18966f50..a6473a06dcf7 100644
@@ -989,7 +989,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 		 * Note: this is from llite(see ll_dir_ioctl()), @uarg does not
 		 * point to user space memory for FID2MDTIDX.
 		 */
-		*(__u32 *)uarg = mdt_index;
+		*(__force __u32 *)uarg = mdt_index;
 		break;
 	}
 	case OBD_IOC_FID2PATH: {
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 drivers: staging/lustre: lmv_obd.c - suppress Sparse user cast warning

Quoted 15 lines · Michael Sartain

Comment above assignment states that uarg does not point to user space memory (ll_dir_ioctl does copy_from_user), so this is a valid cast. This patch adds a __force annotation to suppress the "cast removes address space of expression" Sparse warning.

---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +0 -0
index 271e18966f50..a6473a06dcf7 100644

drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, · line 992

Quoted 5 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
@@ -989,7 +989,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 		 * Note: this is from llite(see ll_dir_ioctl()), @uarg does not
 		 * point to user space memory for FID2MDTIDX.
 		 */
-		*(__u32 *)uarg = mdt_index;
+		*(__force __u32 *)uarg = mdt_index;

Really? This is correct? If so, ugh, something is really wrong with the lustre code and it should be fixed "correctly".

thanks,

greg k-h