From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id EC4501EF6B4; Thu, 18 Jul 2013 21:34:25 -0400 (EDT) Received: from jdc.jasonjgw.net (jdc.jasonjgw.net [IPv6:2001:44b8:412f:6e00::2]) by befuddled.reisers.ca (Postfix) with ESMTPS id 183B11EF56E for ; Thu, 18 Jul 2013 21:34:25 -0400 (EDT) Received: by jdc.jasonjgw.net (Postfix, from userid 1000) id 6CA471808B65C; Fri, 19 Jul 2013 11:34:18 +1000 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=jasonjgw.net; s=mail; t=1374197658; bh=bqznt0yeIwq0Ft8I++LHJWBxoMdTxXPY9Tj8T777Ogs=; h=Date:From:To:Subject:References:In-Reply-To; b=shyAFw5LjeKK/zKklgZ0CdVxdIV/oodiFz0Jq5KPrpOtHnKQ6iaZeQh01JVVNJQEx /RVcMszBbyohezVqW5W2zLgLHXT5x7UN5MFUovgrKS0NuGnw9yAb8hc69+ywB5Cr6H nSAw4rngawoMbpgPAXF/pmCCAaR89Slt+5nWG480= Date: Fri, 19 Jul 2013 11:34:18 +1000 From: Jason White To: speakup@linux-speakup.org Subject: Re: OT: kernel oops Message-ID: <20130719013418.GA8869@jdc.jasonjgw.net> References: <0d30e6e5-261e-47e0-b5da-2ce5fe6bad24@default> <87mwpjx3ae.fsf@mushroom.PK5001Z> <20130718234302.GA7934@jdc.jasonjgw.net> <481c693b-a8bb-4700-baca-6e4a44fc23d6@default> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <481c693b-a8bb-4700-baca-6e4a44fc23d6@default> User-Agent: Mutt/1.5.21 (2010-09-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.2 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jul 2013 01:34:26 -0000 Don Raikes wrote: > If (copy_to_user(buf, tbuf2, count)) > > Buf is defined in the parameter list of my function as: > Const char __user * buf It's also the destination of the copy, so it shouldn't be const. You're declaring the buffer as const, then passing it to a function that will write to it. This is why the compiler complains that you're discarding the const qualifier when you pass this parameter to the function. Does that help? It's probably best to remove the "const" from the declaration of buf. Alternatively, you can use a cast expression in the call to copy_to_user, but declaring a parameter as constant and then casting that away is not a good practice in my personal view.