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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD82C4332F for ; Fri, 3 Nov 2023 05:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbjKCFxj (ORCPT ); Fri, 3 Nov 2023 01:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjKCFxi (ORCPT ); Fri, 3 Nov 2023 01:53:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB72CA for ; Thu, 2 Nov 2023 22:53:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5115C433C7; Fri, 3 Nov 2023 05:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698990812; bh=SLDh5CRv5TerU2o1EBxZL6kLDkZ+m92HwcWGlcin2Do=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l36GQT4IS9SgDme6D1V6VJfiJ4NIIfbzjSgcULp2gv2xoZl4as+v23Vm6IeIjas9P zOyYl6rFRxei/LG9K/esfeKO5kuILIKoIyTNE61ReIwJeOYw+F/PNBAZS7qiEzUut/ seWtOBfck9HldM0pbHGe21ldsL3nNUy0XEFUSkgs= Date: Fri, 3 Nov 2023 06:53:29 +0100 From: Greg Kroah-Hartman To: Philipp Stanner Cc: Ian Abbott , H Hartley Sweeten , Ivan Orlov , Benjamin Tissoires , linux-kernel@vger.kernel.org, Dave Airlie Subject: Re: [PATCH] drivers/comedi: copy userspace array safely Message-ID: <2023110348-drained-tameness-b943@gregkh> References: <20231102190848.51376-2-pstanner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231102190848.51376-2-pstanner@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 02, 2023 at 08:08:49PM +0100, Philipp Stanner wrote: > comedi_fops.c utilizes memdup_user() to copy a userspace array. This > does not check for an overflow. Is there potential for an overflow today? > > Use the new wrapper memdup_array_user() to copy the array more safely. How about saying something like: "Use the new function memdup_array_user() in case things change in the future which would prevent overflows if something were to change in the size of the structures". Or something to the affect of "all is good today, but make it easy to be correct in the future as well". thanks, greg k-h