Skip to content

Commit a60511c

Browse files
Linus Walleijkuba-moo
authored andcommitted
net/rds: Pass a pointer to virt_to_page()
Functions that work on a pointer to virtual memory such as virt_to_pfn() and users of that function such as virt_to_page() are supposed to pass a pointer to virtual memory, ideally a (void *) or other pointer. However since many architectures implement virt_to_pfn() as a macro, this function becomes polymorphic and accepts both a (unsigned long) and a (void *). If we instead implement a proper virt_to_pfn(void *addr) function the following happens (occurred on arch/arm): net/rds/message.c:357:56: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] Fix this with an explicit cast. Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com> Cc: rds-devel@oss.oracle.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220829132001.114858-1-linus.walleij@linaro.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7305b78 commit a60511c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/rds/message.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
354354

355355
for (i = 0; i < rm->data.op_nents; ++i) {
356356
sg_set_page(&rm->data.op_sg[i],
357-
virt_to_page(page_addrs[i]),
357+
virt_to_page((void *)page_addrs[i]),
358358
PAGE_SIZE, 0);
359359
}
360360

0 commit comments

Comments
 (0)