Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5269981rdb; Sat, 16 Sep 2023 09:22:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkN7Azwx1EFSXpgxjkBa6h2k0eShkiXQnXSQBkGlUOJ+No7osVByne7WAR0H87tOiEQhAy X-Received: by 2002:a05:6a00:851:b0:68f:ca89:9c71 with SMTP id q17-20020a056a00085100b0068fca899c71mr5753991pfk.10.1694881324929; Sat, 16 Sep 2023 09:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694881324; cv=none; d=google.com; s=arc-20160816; b=KQX4XKU/ma1zyMW4xwR74c+kisPNtMzA9L0E2oO98wUt9YX08aWjQ2p5ZNdVoVaUzL 3eTmvsI+yhDRvpEROXGff12e895DxsOBTHjKSXgMsIh1IXmhVLUnc7cvixjkFisFO5Bs HIa9ecTnTkUCrKL2ZqKqdYsyqLlzdLNMzGoVwBsponYsK14INb5oMR9kXgZp2wn1JaZy zhvCe21Gc0slylvsOBkUMjpUrqwsR7avKjlfMzq9HI0u+QSvhPUFh41c20rhsAwzOGri 5PpOLQkCMEK/5KuHSCvUuS0KcW/z51oUlv8QxvPiGwPHa2iK8a32pEgwFvJU1YKw0/q1 Gs0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RuCMRYRUI5pE2pACmrLEmespxY+dxj38Ol7yGsVBHSU=; fh=Jg7SjLOpjefGLFKef+aVSeSjzGm66YEiCA2zpKIhCaE=; b=sFQp5SUwG0jlx73mccYXIrzHapZweEbIj12Y/UTviEdye4VjFTL7LsTTkYHPpcruLq t6w2F/cicSfaU0Cjju45ZRpMS6GujvhpXSZXccRxCQDLV0co+mlueYVeFMHahdRgj7c/ ZLpaqNAFsWG0j9r+QHs6kFNAe1IR8gZ6drYzurLvz0m32SrROcM/BdtdY3WmhmXVf+is 348Hz8pqMdRuNuT8PwMm9lWyWNXbboyPYxF/3WILng3xdW+mK5aAhKqXzhWBFwPTdr4N qWkvFrb+KdOMrdVQP8SFham6RPpXrCILr+QKeEjh/Kekb6vayE+plII6z0GBs3PT+IjQ QVXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PuqGDe6C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cp16-20020a056a00349000b0068ffd96e1d4si5117601pfb.165.2023.09.16.09.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 09:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PuqGDe6C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3AC87860521C; Sat, 16 Sep 2023 07:33:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbjIPOdU (ORCPT + 99 others); Sat, 16 Sep 2023 10:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232018AbjIPOcw (ORCPT ); Sat, 16 Sep 2023 10:32:52 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66640CE8 for ; Sat, 16 Sep 2023 07:32:47 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31ad9155414so2846204f8f.3 for ; Sat, 16 Sep 2023 07:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694874766; x=1695479566; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RuCMRYRUI5pE2pACmrLEmespxY+dxj38Ol7yGsVBHSU=; b=PuqGDe6CZBYIFMsaW2bIwkwwRy+umt+pbvUsZgYaxXTsxpY1MY6UcdFcZ32Xbzhh7N MPtR9SDdRpoYnQ0CJWuUAl5Zwuu2iXIwQSB45yIEHNI6QN0qkpOWvtr38c5rMBi7UW+1 kB0Dg/gHWlFRM3RvaEZd3pEYv/vyuwqBb+TTigDXkYC8Dww5Y43o8X7CF8ebSVexZmyU 6mxVceBfza4WEp8kmD+9IZjzi65t87Cw1Ro47uIq72+4iovstqZ+Oqtk31ztOpUy8PK+ KNDiPibdXcAckXdAguzGwFnZOMa54ovBINgtgM8kNgG7HoETDk3KvXVCv+iIedCWkTqk mXyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694874766; x=1695479566; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RuCMRYRUI5pE2pACmrLEmespxY+dxj38Ol7yGsVBHSU=; b=PRMPvkXuG8/qZ5Out/WlQv5JucUk15/6S/285MGezthZtMRu2SwbJMv+mbixbiBVux VTEC8udvar9H15Gh3xQWCQrkm8b6PlI0aEJsi7ci68fDWFFvO3rZ//MUJDtecWPoP085 IKkncgXKjVhFGWUo4HvyoxvAFBRovtFK4m4n+S2RB5pLpKgsLVHuRRxiTmTiozQcMIkk 8ZlU1Yu7prYksPpED+ghNN5KPcJZdQ1I4RwV2i/qpGlOoqQWzKHPjvfTydDM2D6/EFxk RVtIa4jkj41NKekdzxQw+TdKkEwN5oXBtEU88uk2BRTgFXlyS+HKee4XPeNdt7tEPxPd 4Wrw== X-Gm-Message-State: AOJu0YyTXdNRB4wnLNzDHkmg5iwad2J6KSK6FmVx0uyY8rxDFuwIzTaR SbKwpT88saNI3aBUZg2OCCxJWw== X-Received: by 2002:a05:6000:a1a:b0:31f:facb:e1ba with SMTP id co26-20020a0560000a1a00b0031ffacbe1bamr2807958wrb.70.1694874765714; Sat, 16 Sep 2023 07:32:45 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id j15-20020a5d604f000000b0031779a6b451sm7270032wrt.83.2023.09.16.07.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 07:32:45 -0700 (PDT) Date: Sat, 16 Sep 2023 17:32:42 +0300 From: Dan Carpenter To: Philipp Stanner Cc: Kees Cook , Andy Shevchenko , Eric Biederman , Christian Brauner , David Disseldorp , Luis Chamberlain , Siddh Raman Pant , Nick Alcock , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Zack Rusin , VMware Graphics Reviewers , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-hardening@vger.kernel.org, David Airlie Subject: Re: [PATCH v2 1/5] string.h: add array-wrappers for (v)memdup_user() Message-ID: References: <93001a9f3f101be0f374080090f9c32df73ca773.1694202430.git.pstanner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93001a9f3f101be0f374080090f9c32df73ca773.1694202430.git.pstanner@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 16 Sep 2023 07:33:48 -0700 (PDT) On Fri, Sep 08, 2023 at 09:59:40PM +0200, Philipp Stanner wrote: > +static inline void *memdup_array_user(const void __user *src, size_t n, size_t size) > +{ > + size_t nbytes; > + > + if (unlikely(check_mul_overflow(n, size, &nbytes))) > + return ERR_PTR(-EOVERFLOW); No need for an unlikely() because check_mul_overflow() already has one inside. I feel like -ENOMEM is more traditional but I doubt anyone/userspace cares. > + > + return memdup_user(src, nbytes); > +} regards, dan carpenter