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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 0D1A0C433E7 for ; Tue, 13 Oct 2020 10:58:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8D6D208D5 for ; Tue, 13 Oct 2020 10:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602586702; bh=eQMWAJg5c5/Xk4OQukQZyjkJ7g5KWKnsWMc0GtSgxiw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=wVvu7/GrBR508vlkIygdAv4pSn5ZWTlVN20LZZgzEyxaQQt7nCjxUayQH5VSV6yVj 7umvFcAvHDzxS7zL9CNblV+2mU77Hxb4A21ulKthDGerJZLdfwXbgI2nhKBQ/MclDI h+3CDBEZBSbyu9MOryzzaw3tDDsJ2LFf97GcsROI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387607AbgJMK6V (ORCPT ); Tue, 13 Oct 2020 06:58:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:39682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727097AbgJMK6V (ORCPT ); Tue, 13 Oct 2020 06:58:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47DB62072C; Tue, 13 Oct 2020 10:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602586700; bh=eQMWAJg5c5/Xk4OQukQZyjkJ7g5KWKnsWMc0GtSgxiw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TPqn2sAbLhP8TG8uah7EKCC0ic2flaaE+vAaUqCrlanhF8FT4JiYYM/uY4YzT937A kJ89V1B86+wWcyiWOvjUo3RuZGi32j2IMKl70AkOlr5U0M8DWYl1NZUGeItDZSeSEf +mO5tCxurLCr3A1Q/qkXrCyvRmytJaNrk/Y0ONdA= Date: Tue, 13 Oct 2020 12:58:57 +0200 From: Greg KH To: harshal chaudhari Cc: Sudip Mukherjee , linux-kernel , Arnd Bergmann Subject: Re: [PATCH] char: ppdev: check if ioctl argument is present and valid Message-ID: <20201013105857.GA1940039@kroah.com> References: <20201008182713.2764-1-harshalchau04@gmail.com> <20201009045734.GA112189@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 02:31:21PM +0530, harshal chaudhari wrote: > On Sat, Oct 10, 2020 at 2:41 PM Sudip Mukherjee > wrote: > > > > On Sat, Oct 10, 2020 at 1:08 AM Sudip Mukherjee > > wrote: > > > > > > On Fri, Oct 9, 2020 at 5:57 AM Greg KH wrote: > > > > > > > > On Thu, Oct 08, 2020 at 11:57:13PM +0530, Harshal Chaudhari wrote: > > > > > Checking the argument passed to the ioctl is valid > > > > > or not. if not then return -EINVAL. > > > > > > > > Along the the comments that Arnd made, this is not the correct value to > > > > be returning from an ioctl when you don't pass in the correct command. > > Thanks Greg for the comment. i am checking with value > -EFAULT now, i will get back to you with changes as consideration > of Arnd comments. -EFAULT is only used if there really is a memory fault, which I strongly doubt is the case here. > > > > And it doesn't match what your patch says, please be consistent. > > I just want to perform the Argument check here only. back then i > was trying with access_ok() as well, but access_ok() return success > even if i passed a NULL pointer. so that's why i removed it from here. access_ok() should never be used in drivers anymore. thanks, greg k-h