From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5906FC2B9F2 for ; Sat, 22 May 2021 06:34:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29D3B6120D for ; Sat, 22 May 2021 06:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbhEVGfd (ORCPT ); Sat, 22 May 2021 02:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbhEVGfc (ORCPT ); Sat, 22 May 2021 02:35:32 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72520C061574 for ; Fri, 21 May 2021 23:34:08 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lkLCh-00HMua-KY; Sat, 22 May 2021 06:33:43 +0000 Date: Sat, 22 May 2021 06:33:43 +0000 From: Al Viro To: Nguyen Dinh Phi Cc: nsaenz@kernel.org, gregkh@linuxfoundation.org, stefan.wahren@i2se.com, arnd@arndb.de, dan.carpenter@oracle.com, phil@raspberrypi.com, amarjargal16@gmail.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address Message-ID: References: <20210522053429.82710-1-phind.uet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210522053429.82710-1-phind.uet@gmail.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 22, 2021 at 01:34:29PM +0800, Nguyen Dinh Phi wrote: > This commit to fix the following sparse warning: > incorrect type in assignment (different address spaces) > expected void *[assigned] userdata > got void [noderef] __user *userdata > > Signed-off-by: Nguyen Dinh Phi > --- > .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > index afbf01b7364c..2a4fc599f977 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > @@ -960,7 +960,10 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, > current->pid); > userdata = &waiter->bulk_waiter; > } else { > - userdata = args->userdata; > + if (copy_from_user(userdata, args->userdata, sizeof(args->userdata))) { The contents of userdata (local variable of type void *) is uninitialized at that point. Just what do you think that call of copy_from_user() would do?