Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3989855iog; Tue, 28 Jun 2022 06:59:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tttOL9JQH13ehycDLffAc5PQcOPIuCgF24wX9+aCrZj6UqHr+FqM5d+gnuIfbq+dQhLDMG X-Received: by 2002:a17:902:aa41:b0:168:8d12:540b with SMTP id c1-20020a170902aa4100b001688d12540bmr5222645plr.35.1656424747886; Tue, 28 Jun 2022 06:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656424747; cv=none; d=google.com; s=arc-20160816; b=hR45k3N4x+n8qc6wTKFWXwY+scJhwyRFB634or9cbi3ceNgx0texgxIpV/OVTiHbP6 YMFhHG9e87HakLzt8tWjPwo0p2qt18Kqp0EeXaC8zxxQtdHNDVNyYVh3+G63dz6qzNq5 F+W0ZEkvevNcYMpt+JcSOchFNyJTIOj0SOzy8wh8o4QrEo8VWtHPzNK6uDWE5OHFiaFV UXeFzS5VH5kw/donQ7UTYM051ex9RXvfa30/ygemWJkt0B9904NKhJ+juKbTgoCL0jrs DTYGTpN6TxeqMsPKdpOkUs/IkcQsgDYBTJPR6Z9SeNGM6ZgHBncQYRpd3vfu5Pyz97I6 tGXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=3FEXn91GVNvx8HwFiV6McvXwtAYEGKEWO5SJ8ez8JNk=; b=Ntp3SPhMh++nCyfUiADVH27p5B4Z1GoZ1qNNjnkk7sxqiSRdth3/VCOVNe3mEZmlMG 2Lq92q1c7x/4TDs44dyLUlENx2ALOy7FxZDGX6tQxVkggbuyfFGAV8SGmEhEXsFnVHSo +PrbijXHUQGpgDn22XOWgPHROCLCxozmp0z1MPB4jeMa0VjaxJwIKDXHg/pJt81UxCoM Faz6+gvz6RriZnKnH71IeRWRCZZLvCi51JOeB1ypd51gvQMrd7PyugqR8uWPV9PBe7qy 68HUJO5knIaNFrVmHA5opzxVHgayq87g2h9v89rkMKxREHf28yYCx+0ZDNa6KcFS9zkP x/cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQhC6qT+; 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 j70-20020a638b49000000b0040d24308fa2si19022745pge.414.2022.06.28.06.58.52; Tue, 28 Jun 2022 06:59:07 -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=cQhC6qT+; 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 S1346815AbiF1Noc (ORCPT + 99 others); Tue, 28 Jun 2022 09:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346792AbiF1NoY (ORCPT ); Tue, 28 Jun 2022 09:44:24 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5C01C91D for ; Tue, 28 Jun 2022 06:44:22 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id i1so13284571wrb.11 for ; Tue, 28 Jun 2022 06:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=3FEXn91GVNvx8HwFiV6McvXwtAYEGKEWO5SJ8ez8JNk=; b=cQhC6qT+DMM5ZBiRXB+TolvS3WHRrq92BFhnMzhzuqvM/6XB31Er753Eyfqv0/wlzJ YiJu1jjh6qQ4q6sh7JNp9Vq8MmKlbOStXrtaD6orvq7gQQjYhjaS5fR1MktZpWOkOZrI NVewqBeA1knlgvFHs5cXeNrYkDnh1pBblVI5Aqvv0vO573YMnju9olba60+5jS1yGSA2 RESwmIJM2BWTYQSlQqamGJ5HK0WmYkjFWIaXwz5gzwpFm2T/SGCwSvR+YnT/pawxbwE3 RTiULhs5r1pYUgF+14ijkS4yo69FiCFIkCA18LIBUEUcnDh/2lZ6aZBafiBBJQLaky2p iQ+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=3FEXn91GVNvx8HwFiV6McvXwtAYEGKEWO5SJ8ez8JNk=; b=14xOcMSNN9kupXaKtm6lvT4Qu8dZRwNiWjqj+bKrhAl6MDxjri2i9ZEAoLZY3WCNZ8 hDPtZ46WN+smrTv5agnOdoeh81BvWbC/gjW5YlAsFNW8GoQZmBMPdGxHkI3kyaHCjRRl l/U7We3CYT6K2udOgFOUDIzAceEFIR3jgRg5jl+KkzzFLo3cL+vP6y/wWmKCUs6JUTCO g5afdbZWZHCBtpsot+xtlmDYJatWcNKGRmQ9yiy+B52hNxUw9BghiHnBRBTfbKvNIPc4 JEoQSjkt1T0ZS9/L6DnLyfY9/0Ym2rZDj00Cxj3DQykbm4hFitpBvVGq5ZxDnrmF7mGV DmMA== X-Gm-Message-State: AJIora+cssJq6Yke00Aj0Y87vvn3iqwIk73buY3taMmZ8SS8eO5gOosX 4G4nVBk7bu1+e6oHD8Wy8SRMtCLsOYyaAQ== X-Received: by 2002:adf:e60a:0:b0:21b:8af9:e78a with SMTP id p10-20020adfe60a000000b0021b8af9e78amr17881899wrm.395.1656423861425; Tue, 28 Jun 2022 06:44:21 -0700 (PDT) Received: from [192.168.0.254] (xdsl-188-155-176-92.adslplus.ch. [188.155.176.92]) by smtp.gmail.com with ESMTPSA id t7-20020a05600001c700b002167efdd549sm13673863wrx.38.2022.06.28.06.44.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jun 2022 06:44:20 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2022 15:44:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v3] soc: qcom: cmd-db: replace strscpy_pad() with strncpy() Content-Language: en-US To: Douglas Anderson , Bjorn Andersson Cc: Matthias Kaehlcke , Andy Gross , Konrad Dybcio , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220628064301.v3.1.Ie7b480cd99e2c13319220cbc108caf2bcd41286b@changeid> From: Krzysztof Kozlowski In-Reply-To: <20220628064301.v3.1.Ie7b480cd99e2c13319220cbc108caf2bcd41286b@changeid> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 28/06/2022 15:43, Douglas Anderson wrote: > Commit ac0126a01735 ("soc: qcom: cmd-db: replace strncpy() with > strscpy_pad()") breaks booting on my sc7280-herobrine-herobrine > device. From printouts I see that at bootup the function is called > with an id of "lnbclka2" which is 8 bytes big. > > Previously all 8 bytes of this string were copied to the > destination. Now only 7 bytes will be copied since strscpy_pad() saves > a byte for '\0' termination. > > We don't need the '\0' termination in the destination. Let's go back > to strncpy(). According to the warning: > If a caller is using non-NUL-terminated strings, strncpy() can still > be used, but destinations should be marked with the __nonstring > attribute to avoid future compiler warnings. > ...so we'll do that. > > While we're at it, let's change the query array to use > "sizeof(ent->id)" so it can't possibly go out of sync with our later > copy. > > Fixes: ac0126a01735 ("soc: qcom: cmd-db: replace strncpy() with strscpy_pad()") > Signed-off-by: Douglas Anderson > Reviewed-by: Matthias Kaehlcke > Reviewed-by: Krzysztof Kozlowski > --- > > Changes in v3: > - Add comment that query isn't necessarily '\0' terminated. > Thanks! Best regards, Krzysztof