Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1706704rwd; Fri, 9 Jun 2023 00:34:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ49/dOlqBXxTAYkX/tbcCX74KWtEslkJt1Be7wAz2ARSSBIL7iwgr9nAGjvzIEbJpeyUy5M X-Received: by 2002:a05:6a21:6d82:b0:10f:f672:6e6b with SMTP id wl2-20020a056a216d8200b0010ff6726e6bmr339936pzb.5.1686296072952; Fri, 09 Jun 2023 00:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686296072; cv=none; d=google.com; s=arc-20160816; b=1IAvLI+GNEFBiGkyW7OJacPVICxurKo4schJyFNkp0/kTBaoqkxxov1MfrQPi2BP+8 aTkrRN/xecdvDmo4bPClzaWWqpva4J8ejbI+GZo4Pb4ii74IbR8Xn7+32W1i5PKTkNyP h/IChQgmQzbbreJYoeKQbemQ0xyEZpeeJ279K+Ft2d2tQWGkHWm3WrsHvjrqXV8qvgqT OphjuqxGvLA+/EsuBOhfRTXHzYMVr1LZFu14aHHiQbe2irnrLT63QWYEbQjrYVyF5BWk ALiq95Wg/PtFbmHQBL7/uwjSUAGql9QxHwffAeR/t2/sMEda0aQijg9CVwGJKGtQvD2G IjLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zqR4+wxVQ0djZi5VqEW6OMI/6pVtmx3wzdSI7GLh/j0=; b=lL3YRp/oLbIUYtbuGEJ8MZozBEa2zyqwIqcvn9quBjmz626QW4M/551CDiUl8CPWaf KnBi4upfWyolLnUx2TAJodOgbH50hUoQm6Gg3wdicYoDhM0+hgOzJKl96yQZxhVS7QhP wAz7EWc7QUIHAqbC8p9/SyO5ZzV6yJySeQlu+WLVZHyBIh6poHnlCSpBXJpOqbzrs+7D aPG+vb6Lwq/SN5pyxYXGw7pzfmtrcG/73w4k8h8lnSap0/sftlEXiJrrQ6wuEKIOBf5S pEoy5BcXwExgecGcMVf6LFwlU3sgJYcJQqab+lKVG3MZrC9c9e2ziQlVdCYLbKnCkVkp AWVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eN2o2tWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n19-20020a635c53000000b005300dbf81d5si2300962pgm.496.2023.06.09.00.34.20; Fri, 09 Jun 2023 00:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eN2o2tWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238399AbjFIHWB (ORCPT + 99 others); Fri, 9 Jun 2023 03:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238390AbjFIHVp (ORCPT ); Fri, 9 Jun 2023 03:21:45 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1422C18D for ; Fri, 9 Jun 2023 00:21:45 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-bb15165ba06so1451280276.2 for ; Fri, 09 Jun 2023 00:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686295304; x=1688887304; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zqR4+wxVQ0djZi5VqEW6OMI/6pVtmx3wzdSI7GLh/j0=; b=eN2o2tWJbGiu31bKSfBVTtFZJT31Bj9JGX2tD6cCYxh4Xae3C9A6kusl5zs8Hljit/ ZZdTkyTbH7GnXwa1R7OgMALLbGo+JvZxRj0x7iBIiMbfIVOZmm776Vo6Ybm3Ai3VtnDE g2hz1v55bCdvjVCsYYVM/fKvSyeJ8cOacOQEpvRHbRsFFWJZT4wGQmYu8YYzvQCrhe/Y AssItq7D/SLGh4ZevKDHgWp3OIOGdZ7Hcy2Sw5pvv/g4L1jBUeLSFEwV0TXUd8ZJjOLv Viw4bePceInNJqozG6DezC+w+YngQ9hZ382d43he2IZOilXsEELG7xxMRvh2X5YTKv7y PiEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686295304; x=1688887304; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zqR4+wxVQ0djZi5VqEW6OMI/6pVtmx3wzdSI7GLh/j0=; b=YmpSAD5rksLXOl39UbT9RIcPFafkK8SPDE7orxejAiKAtv4Y885wvt51Iwgd3AynAl xxzvcRF1nGNPWy1oGGUtHXEN+7h1MmpvlfhT0ZcVYVr7JEf/JHZ2zyzSGKCsvCrqUwd7 hjI4Bwld2Zk3tfmaOh7p1h7Zl7DAM4CLBnov5jizpPifkVBBvJWj1onwCM/2JewbapNC LcgB1eyPcB6TpGur+xdZlDlcNMPX7WMDN/ov/jigoVlhebf/g/aw9LKoZtSooIL0K+Te Bj5UU+lKv8szqGNTAlWeDFh6/3PRQ7JSqony3Tlj91lBpk+q1Y4KtPFWBLRV3q2eAYUd IY0Q== X-Gm-Message-State: AC+VfDw3eBpOc+O9eSnLLXENz/SONTM9f02PfPzRPJZU6cdL7mp1hWfo zhpG625H+bCK+fbn+rpsldLo5V/BjGyJ1XXRudzPVe6qKV7KbuRh X-Received: by 2002:a25:1384:0:b0:bad:822:d9d1 with SMTP id 126-20020a251384000000b00bad0822d9d1mr360226ybt.19.1686295304362; Fri, 09 Jun 2023 00:21:44 -0700 (PDT) MIME-Version: 1.0 References: <20230604131215.78847-1-andriy.shevchenko@linux.intel.com> In-Reply-To: <20230604131215.78847-1-andriy.shevchenko@linux.intel.com> From: Linus Walleij Date: Fri, 9 Jun 2023 09:21:33 +0200 Message-ID: Subject: Re: [PATCH v1 1/2] pinctrl: Duplicate user memory in one go in pinmux_select() To: Andy Shevchenko Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,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 On Sun, Jun 4, 2023 at 3:12=E2=80=AFPM Andy Shevchenko wrote: > Current code is suboptimal in three ways: > 1) it explicitly terminates the string which is not needed; > 2) it might provoke additional faults, because asked lenght might be > bigger than the real one; > 3) it consumes more than needed lines in the source. > > Instead of using kmalloc() + strncpy_from_user() + terminating, just > utilize memdup_user_nul(). > > Signed-off-by: Andy Shevchenko Excellent patch, applied! Yours, Linus Walleij