From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933407AbbBCXsa (ORCPT ); Tue, 3 Feb 2015 18:48:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55827 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933237AbbBCXs1 (ORCPT ); Tue, 3 Feb 2015 18:48:27 -0500 Date: Tue, 3 Feb 2015 15:48:25 -0800 From: Greg Kroah-Hartman To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Amit Shah , Arnd Bergmann , virtualization@lists.linux-foundation.org Subject: Re: [PATCH] virtio_console: fix sparse warnings Message-ID: <20150203234825.GA24626@kroah.com> References: <1417433749-17408-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417433749-17408-1-git-send-email-mst@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 01, 2014 at 01:35:57PM +0200, Michael S. Tsirkin wrote: > CHECK drivers/char/virtio_console.c > drivers/char/virtio_console.c:687:36: warning: incorrect type in > argument 1 (different address spaces) > drivers/char/virtio_console.c:687:36: expected void [noderef] > *to > drivers/char/virtio_console.c:687:36: got char *out_buf > drivers/char/virtio_console.c:790:35: warning: incorrect type in > argument 2 (different address spaces) > drivers/char/virtio_console.c:790:35: expected char *out_buf > drivers/char/virtio_console.c:790:35: got char [noderef] > *ubuf > > fill_readbuf is reused with both kernel and userspace pointers, > depending on value of to_user flag. That's horrid, don't do that. Have two different functions for this type of thing, otherwise you defeat the whole purpose of trying to track __user pointers. thanks, greg k-h