From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id A61641EF6B4; Fri, 19 Jul 2013 01:34:00 -0400 (EDT) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by befuddled.reisers.ca (Postfix) with ESMTPS id DB5471EF56E for ; Fri, 19 Jul 2013 01:33:57 -0400 (EDT) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r6J5Xp5k019073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Jul 2013 05:33:51 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6J5XoxX016942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 19 Jul 2013 05:33:50 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6J5Xn6i024116 for ; Fri, 19 Jul 2013 05:33:49 GMT MIME-Version: 1.0 Message-ID: <8d1e7965-5bfe-4739-97a9-f483a615ca23@default> Date: Thu, 18 Jul 2013 22:33:48 -0700 (PDT) From: Don Raikes Sender: Don Raikes To: "Speakup is a screen review system for Linux." Subject: RE: OT: kernel oops References: <0d30e6e5-261e-47e0-b5da-2ce5fe6bad24@default> <87mwpjx3ae.fsf@mushroom.PK5001Z> <20130718234302.GA7934@jdc.jasonjgw.net> <481c693b-a8bb-4700-baca-6e4a44fc23d6@default> <20130719013418.GA8869@jdc.jasonjgw.net> In-Reply-To: <20130719013418.GA8869@jdc.jasonjgw.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: acsinet22.oracle.com [141.146.126.238] 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 05:34:01 -0000 Ok so I get it, but the problem is that I am hooking into the sys_write sys= temcall, and it is by default cast to a const. If I leave it as is, and cast the buf in my copy_to_user to a (char*) shoul= d that work? Sorry my knowledge of c is very limited :) It looks at the moment like when I do the sys_write function then try calli= ng the sys_close that I have lost the pointer to my file. Could I have messed up the stack yet again? -----Original Message----- From: Jason White [mailto:jason@jasonjgw.net]=20 Sent: Thursday, July 18, 2013 6:34 PM To: speakup@linux-speakup.org Subject: Re: OT: kernel oops Don Raikes wrote: =20 > If (copy_to_user(buf, tbuf2, count)) >=20 > 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 dec= laring the buffer as const, then passing it to a function that will write t= o it. This is why the compiler complains that you're discarding the const qualifi= er 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, b= ut declaring a parameter as constant and then casting that away is not a go= od practice in my personal view. _______________________________________________ Speakup mailing list Speakup@linux-speakup.org http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup