Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3468894iog; Mon, 27 Jun 2022 17:14:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1thT+HwYDdtmPD1mllEL+Jv1CR7A7/Wn7rsuWB0ugYgLUTJpp4Z/kCZRTtwhTzNHn9Dmubt X-Received: by 2002:a05:6a00:1748:b0:525:4731:7f11 with SMTP id j8-20020a056a00174800b0052547317f11mr1798251pfc.72.1656375263249; Mon, 27 Jun 2022 17:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656375263; cv=none; d=google.com; s=arc-20160816; b=DdmvzJ8memlsNTImzhBtQ6lM47++Akj6/uLYUDZiYvJFpVDxPWI4QK+3ufKQq32Unn pxz9xByoQdPr68QZHoyrHp4Oj2W+old9l1Yro6a9l1GciDjoq80UnEIh4HdLc9XwaBZF vEH1nKVOXDGdtHgdtrSipEcd2PZBiTO2nhQ8HnjofZzbFA2gQdyxAr00CyOjLy/bbAiv Y/OHFptiU2fLuMoCnOjgchema2fXxUGEyI9pjjwG9CTe0gKguoEaazo8J0oxFhcI/cOf zNADzVDHWMF/iR3J19FZwZ3TMF6zAEm1pi4h2ZMfOdOkhswGBvDp5NkupQDPbqCQCYyj dPRg== 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=AqgAK6vW0sjwljhDhF+wDDYOvFeDeqUAJsWDqLfwnOY=; b=WnP0Mz/NNlBsASSjLRyLb+Z6q4dAnIA8DYoKlVLB/U72/UG+udFAHXxAE3v1s/vITV NoVfoi5l8qHw6RjQf62kkSsRbviwwciXmbDJWaTxIZc5FY0n2sg4Hgxf4OkXC/UqAlh4 4F/8SCqUNUMIwj7/2IF7aQCFFfBlb7x8d/GsV1UL9IwcwoRenHBRHI9wtbctnR0niWWi v3lf7RF+tVJlkmv3/tWfa/ka4QwZruPJwDqR/NhwYJK1j8lk7ePGIUNs+ta/iW9PiQd0 ZFSQlg9kOTHJ9qpCNEaySle3zkwAEvZHfn+RSioJplr359TuXnTgdrvxETRX6AqOgsA3 K8/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XwGc2CSD; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a63d851000000b0040cc2530cefsi16583293pgj.375.2022.06.27.17.14.11; Mon, 27 Jun 2022 17:14:23 -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=@chromium.org header.s=google header.b=XwGc2CSD; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241505AbiF0Xtt (ORCPT + 99 others); Mon, 27 Jun 2022 19:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240866AbiF0Xtr (ORCPT ); Mon, 27 Jun 2022 19:49:47 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABFBE0B1 for ; Mon, 27 Jun 2022 16:49:47 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so10916050pjv.3 for ; Mon, 27 Jun 2022 16:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AqgAK6vW0sjwljhDhF+wDDYOvFeDeqUAJsWDqLfwnOY=; b=XwGc2CSDj85YQw3/ioBITivk3gVbW4vBmhsm/WgaJYuwbcetHTmEcccRdL5+qdaiE9 Jr7rtHML6/RJK82HnK30L18MtdtwDN60y/8phzk7bLAnRweyXiHbZw9jqYH84rZfMTOz d/HJJ4EX+bu7oZOiv+fe9DBrPxU0v8NbCUnmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AqgAK6vW0sjwljhDhF+wDDYOvFeDeqUAJsWDqLfwnOY=; b=ZVCA6LMplPM7iWPvEAkLFVSH910auzDPMhYmTLBX9XzWHJXkxldygMTkclUZgWp2nt vA7P8YuQylGfwRfijgcGKfCfjZLLjBLpFENDgeALYlfAvJwcbzfm6Nui3ge8jTjzC7lA jVNNLJmLDxpsVaAedR1JUcMI1gBsD8bvxGDCbfLn+iyCF3zd7ZFXujhGMLZwQ/YMuoys n3mRx6btd3iAaLUGKWSMYbGNEmGYfm13bJbMzmuh+xHSODzYsmbwFYWZhPtf8JNbI5in ApN4qhuTYY1EQN0vzAijGgJaI2n1xUu9LG1V9B/7ZBj7e7OnezmEtDjvHGfHApBtCMZs AO1g== X-Gm-Message-State: AJIora9HHvPfq58W9yG2N5P/1FShRXHvSYQ7X4B3rTaPuw+nfZzNTo4U +5AcZDZogHrtFwHv3FJPHstU7A== X-Received: by 2002:a17:902:f688:b0:16a:81d4:17e0 with SMTP id l8-20020a170902f68800b0016a81d417e0mr1962080plg.174.1656373786783; Mon, 27 Jun 2022 16:49:46 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:f31c:687c:3a61:62c5]) by smtp.gmail.com with UTF8SMTPSA id s1-20020a170903214100b0016a01637620sm7762769ple.76.2022.06.27.16.49.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jun 2022 16:49:46 -0700 (PDT) Date: Mon, 27 Jun 2022 16:49:45 -0700 From: Matthias Kaehlcke To: Douglas Anderson Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] soc: qcom: cmd-db: replace strscpy_pad() with strncpy() Message-ID: References: <20220627161642.1.Ie7b480cd99e2c13319220cbc108caf2bcd41286b@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220627161642.1.Ie7b480cd99e2c13319220cbc108caf2bcd41286b@changeid> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Mon, Jun 27, 2022 at 04:17:00PM -0700, 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. > > Fixes: ac0126a01735 ("soc: qcom: cmd-db: replace strncpy() with strscpy_pad()") > Signed-off-by: Douglas Anderson Reviewed-by: Matthias Kaehlcke