Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263750AbTI2QpN (ORCPT ); Mon, 29 Sep 2003 12:45:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263746AbTI2QpN (ORCPT ); Mon, 29 Sep 2003 12:45:13 -0400 Received: from fw.osdl.org ([65.172.181.6]:63721 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S263750AbTI2QpI (ORCPT ); Mon, 29 Sep 2003 12:45:08 -0400 Date: Mon, 29 Sep 2003 09:44:50 -0700 (PDT) From: Linus Torvalds To: Andries.Brouwer@cwi.nl cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] autofs sparse fixes In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org For cases like this, where we use a kernel pointer and do the "set_fs(KERNEL_DS)" thing to mak ea user-pointer routing write to kernel space, I suggest casting the pointer instead of the function, along with a comment on the "set_fs()". Basically, something like this instead: static int autofs_write(struct file *file, const void *addr, int bytes) { const void __user *data; ... set_fs(KERNEL_DS); /* This cast is legal due to the set_fs()! */ data = (const void __user *) addr; ...->write(file, data, bytes); set_fs(old_fs); } See? That makes the cast more obvious, and it also makes it obvious _why_ the cast from kernel->user pointer is ok in this case. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/