Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5345222pxv; Wed, 28 Jul 2021 08:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpjc/0TV+p7vkNQ5nqpMaFjNqLWGxkrPKLEzqIaRCv37saAkgSFPPVUkfCHyVgxrmdfIE1 X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr116746ejd.172.1627486670238; Wed, 28 Jul 2021 08:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627486670; cv=none; d=google.com; s=arc-20160816; b=LEixblnrk2UKaN7sTenehj4i+S1Nmq7UmcuJLTUx/Lfonk2IIVqQJGZglf7mNTc2FP DfxETIrZY+p9GtiSRyN610En9kSeZnQmuYhUplqnYvHlqTFKnNazEIGbQUMMZNJt6qqe VxrtxvK9am527uySChUGRX2FrvZrCHnX0F8L6LeyMBw4pMfsMHRHl4LbG5374XJJSq5T /RuK++9eUVcPtS0iW/BfkiEqnqRvBn7IDzucTIFOE6KInw5kEU2MKwXFC4u52VLnrfRW dj7Y96UBlHJXP9uOUIhD9htkDyWy6oeuBh0lVP61IQrcWLuvW+wHGK/MoEEDIrgKJJHr ermA== 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-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=lwj/HLLx25t3k46z2+cyQHN7hu6gOVVUi8jiHMczL5U=; b=cvo1OB2WkaeSzrKdJVgOpDlH8rNPR+Wdm8+viRIR4A6fZ9Vj4LIOHUm2xlu4XQyGsV W8rjdggFvwlKqbpc9FwBPWWJhd7DncUfLMUf+IyCF7b/0a/auHHUiU72ki8WXqnKIeFT an1CXMOZ4WqX6hrbGNJJEPfhs8bY+Te29U+ZJ8jvQj9/z7i5CHG/fmJxYe0ZrSKfAsqb +bOW40u2whIkqmR58hL3oCfnZWKrqFRaFWnvVGS9slogw4MpWmPm9eASiPiYcbTDkJLq 8WZCQYoEuxOCS1E8h/LTLnC4KyT0AarAPFAgWcwrspVhbxL/64vQIzMkwXFDQ9L/MRDX 3YEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1J5lvqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si5675553edc.467.2021.07.28.08.37.26; Wed, 28 Jul 2021 08:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1J5lvqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236909AbhG1PgH (ORCPT + 99 others); Wed, 28 Jul 2021 11:36:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:48226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235710AbhG1PgG (ORCPT ); Wed, 28 Jul 2021 11:36:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96D9060EB2; Wed, 28 Jul 2021 15:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627486564; bh=R7+ExG2cGt1JjNkEYM6JWYU8bpH3ZX043RBskfp7S+s=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=X1J5lvqv0UtM7s22u6Bcz7C7RX4lnKQ/cRgdlBlycimDRR1PxDr5W1NwqMUVg/l+g v1xEA0JXds/ShOYGwygyj+BO4Ndp5wKd5+ZcgIZMBOHR6UvQc2QVbMDu/Jkp9qazMY PlKS8G1Pz2TxeBveHBBfqCrDovXdba2jnojGQlDZ85HvCjDor5pRCInIuhZ+f/TFC8 87bFjbO4o7Rp/Y1S1MTa5eXKA6i2S+dxfLiPs6HmuAXWsOdAgkFa5ghHL8LSAYD3Fn A5yCZl7tAQI4xx3WqAo03ddRHPvcpA1zpegA+z/RA7U+LVB8J9HYiQYKxjekHxs3dL LpTBi9a6nMrTQ== Date: Wed, 28 Jul 2021 10:36:03 -0500 From: Bjorn Helgaas To: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= Cc: Amey Narkhede , Bjorn Helgaas , alex.williamson@redhat.com, Raphael Norwitz , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Shanker Donthineni , Sinan Kaya , Len Brown , "Rafael J . Wysocki" Subject: Re: [PATCH v10 4/8] PCI/sysfs: Allow userspace to query and set device reset mechanism Message-ID: <20210728153603.GA821650@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210728012740.GA90475@rocinante> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 03:27:40AM +0200, Krzysztof WilczyƄski wrote: > > > + options = kstrndup(buf, count, GFP_KERNEL); > > > > I assume the kstrndup() is because strsep() writes into the buffer? > > Yes, Amey added kstrndup() in v6 following my recommendation as per: > > https://lore.kernel.org/linux-pci/20210606125800.GA76573@rocinante.localdomain/ > > This was to avoid removing the const quantifier through a type cast > given that the signature of the function denotes that the buffer is > a pointer to immutable string, as per: > > https://elixir.bootlin.com/linux/v5.14-rc3/source/include/linux/device/driver.h#L137 Ah, right, thanks! Definitely prefer not to cast away the constness. I guess the strings here are short (<100 chars max), so no big deal to duplicate them. Sorry for the noise!