Skip to content

Commit bd8c8ad

Browse files
kvaneeshericvh
authored andcommitted
9p: Fix sparse error
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
1 parent 936bb2d commit bd8c8ad

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎net/9p/protocol.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
468468
case 'E':{
469469
int32_t cnt = va_arg(ap, int32_t);
470470
const char *k = va_arg(ap, const void *);
471-
const char *u = va_arg(ap, const void *);
471+
const char __user *u = va_arg(ap,
472+
const void __user *);
472473
errcode = p9pdu_writef(pdu, proto_version, "d",
473474
cnt);
474475
if (!errcode && pdu_write_urw(pdu, k, u, cnt))

‎net/9p/trans_common.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
6666
uint32_t pdata_mapped_pages;
6767
struct trans_rpage_info *rpinfo;
6868

69-
*pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1);
69+
*pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1);
7070

7171
if (*pdata_off)
7272
first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off),

‎net/9p/trans_virtio.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,11 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
326326
outp = pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM,
327327
pdata_off, rpinfo->rp_data, pdata_len);
328328
} else {
329-
char *pbuf = req->tc->pubuf ? req->tc->pubuf :
330-
req->tc->pkbuf;
329+
char *pbuf;
330+
if (req->tc->pubuf)
331+
pbuf = (__force char *) req->tc->pubuf;
332+
else
333+
pbuf = req->tc->pkbuf;
331334
outp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, pbuf,
332335
req->tc->pbuf_size);
333336
}
@@ -352,8 +355,12 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
352355
in = pack_sg_list_p(chan->sg, out+inp, VIRTQUEUE_NUM,
353356
pdata_off, rpinfo->rp_data, pdata_len);
354357
} else {
355-
char *pbuf = req->tc->pubuf ? req->tc->pubuf :
356-
req->tc->pkbuf;
358+
char *pbuf;
359+
if (req->tc->pubuf)
360+
pbuf = (__force char *) req->tc->pubuf;
361+
else
362+
pbuf = req->tc->pkbuf;
363+
357364
in = pack_sg_list(chan->sg, out+inp, VIRTQUEUE_NUM,
358365
pbuf, req->tc->pbuf_size);
359366
}

0 commit comments

Comments
 (0)