Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3130733pxm; Mon, 28 Feb 2022 12:42:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh8YXuv/thoppOsI97dAfDfz9eMmU5dGX19EkZNPVZs1mt2mKBvoaMYVBQ/Rwt1mY83x65 X-Received: by 2002:a17:90b:fd8:b0:1bd:1308:1288 with SMTP id gd24-20020a17090b0fd800b001bd13081288mr13717403pjb.201.1646080925549; Mon, 28 Feb 2022 12:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646080925; cv=none; d=google.com; s=arc-20160816; b=NsyHT3J2oxQqtLwIIkLW8jLWrQN8U3vt0bvVGq/b+AcY2eP6QHL2Efwn1bHh8X1xag 6YNIv13ZQ2OjcKVqKJG5YERszyB9iN3zY4p6oykxCxTJ332x1kVOtbFmBCib7XSgG5TZ J20fYvm3eCL0lS5E9Tit4YhV2bIOGX4fxkSuZyQU5mkJu3OklHq89ChE6evXTBM7YwVV rSbrvuOUmw+eGPEhH8d9V16VhvhLpXC8xRnljJoVdBpfBO6am4MCcYQ291XYyK4cFRfo Pi0Njr/GSCD+mw+LMtLqmTTJFRIzVswnDeOFx6Z2N56Ubsfk8z75kWrrU8QfNTTb2Il7 BQjQ== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=32jldaMr58CIqcLiahosOXSUPSKI8hM1ERQvQID+L/c=; b=n3Njqp9ZGIrMBFhDpbrKqa0zJCrlj/qcyqFopnRvsgKIBSyTT4XRif73B1uIMWWN80 l8MQhJlYsjGWK1BD19l3bVStEknbkOScT4yF3G9vryC5dCNGvsAMmHAUfdH0ej0vaJ1i dKYZ/2AFn28KEIa2bE7xUNugqbljXdwbamwkOzoyjxreoGr1meE3YnAuzGMZS+MTgpIW uyDzo0P5shXsAQscumLzTvFvboDP3TQrLs3AzEFgXwwhU3XgnmwpNUrSgh936nUatKqp 8cCbFoaMc0ecCarEje7+lXVloxGLXoSO404aQJkwTBZU0uFcC8dDeXxV+U1P+01xFFFP sAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aCeGMO5x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bh3-20020a056a02020300b00372dfb3acf7si10536602pgb.690.2022.02.28.12.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:42:05 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aCeGMO5x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E8C34162F; Mon, 28 Feb 2022 12:03:36 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbiB1UEL (ORCPT + 99 others); Mon, 28 Feb 2022 15:04:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiB1UEK (ORCPT ); Mon, 28 Feb 2022 15:04:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B714B255AE; Mon, 28 Feb 2022 12:03:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5FC09B81642; Mon, 28 Feb 2022 20:03:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8D75C340F2; Mon, 28 Feb 2022 20:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646078608; bh=mHHh973hMePN9wmM/jcpBb22Q6OGomp4QlydWc1Dh6w=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=aCeGMO5xD8fsEhRGr4+eOr9z8MstaRRDVGhQ2JFOj5VttTy3IwU/54lJ+oouIG28u z81XCgIJowof9B0hR7N3AT4EL/cp1tR3vbL6RuXPasvJp4dShvWkyCbSLiUvoOUiy9 Ch40bfT8hyQmBKmOBWB/wdlu+kbLkxch8hnE1YJuMD+DqGmnrqOp1buDYyiFRg9zyZ nZTjzG+1MPqyPE0xBXIt+SPfFuZFdVwk0yBkI7QA+0xdPnGZ8DjYwz0x7qT3uUHRRq N8JYHkY9orf+PL5YgJkzP9kJWMETh9P7vFNG2d7Sp1HIFzdd8vaKYbZBnn3S5kUq8h a4Caw+KYsuQwg== Date: Mon, 28 Feb 2022 14:03:26 -0600 From: Bjorn Helgaas To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Stuart Yoder , Laurentiu Tudor , Abel Vesa , Shawn Guo , Sascha Hauer , Fabio Estevam , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Bjorn Helgaas , Bjorn Andersson , Mathieu Poirier , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Gross , Srinivas Kandagatla , Mark Brown , "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, virtualization@lists.linux-foundation.org, Linus Torvalds , Rasmus Villemoes Subject: Re: [PATCH v3 01/11] driver: platform: Add helper for safer setting of driver_override Message-ID: <20220228200326.GA516164@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220227135214.145599-2-krzysztof.kozlowski@canonical.com> X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, Feb 27, 2022 at 02:52:04PM +0100, Krzysztof Kozlowski wrote: > Several core drivers and buses expect that driver_override is a > dynamically allocated memory thus later they can kfree() it. > +int driver_set_override(struct device *dev, const char **override, > + const char *s, size_t len) > +{ > + const char *new, *old; > + char *cp; > + > + if (!dev || !override || !s) > + return -EINVAL; > + > + /* We need to keep extra room for a newline */ It would help a lot to extend this comment with a hint about where the room for a newline is needed. It was confusing even before, but it's much more so now that the check is in a completely different file than the "show" functions that need the space. > + if (len >= (PAGE_SIZE - 1)) > + return -EINVAL;