Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3437259iog; Mon, 27 Jun 2022 16:23:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vPAHWKB+bRvl37UQ6RrEoVPq7w5D17yR5YcP7S9jwALWsc59j9USiMLHSoQB217HYngzgG X-Received: by 2002:a05:6402:350a:b0:435:df44:30aa with SMTP id b10-20020a056402350a00b00435df4430aamr19240806edd.403.1656372196336; Mon, 27 Jun 2022 16:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656372196; cv=none; d=google.com; s=arc-20160816; b=wafQtZvk/yzpEw3tiq28EvMQAKKknIsHWuvjJsylWCUBH1PLF74EydOLUKimXqw6Yk 7anD8Chibwv/qFfCnFXvaOSRQxn2NaetD0cjVavHt5CBC70+vJicN68OdxLMqFNrHtPQ yK3uJ5ffuMhrduUmc+BMw15oJS4G1nink2sIAgCR1GHjg1XGc/zRbZz/ZwPN3DwkJOUe C4yTuWBUtZLFVc6z0j95Jv32qe3I6LDjAF2JO7nVxv8K5zWl2OHZsloPEFF1gOUwVObo HbXjLE2t+OhVyKHFr8pPHUw0w3M0Pczt/YVZF9e38cIJA8goRz5wriq2kAadkGRfyU4c HzSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UfpGy5tAS73+sWM9gF7ZBJ3p3zHT7pkTPz/eUsHxpcI=; b=E0SiJh069UCn1AAwyWjntuL7VbxEa9zwWHNds9LPWsP/citLLv+Jn5nIi8/k9zBLXf za6XMdMpO7WBrEaEUOYjvuGOUbeGHzNtBYLaPkEmlZiHB2Uvs6p0NuO7ZouBQah2ATNk 2KVcxgxTsR4WuvATF/iB3tEDuAFeuBCmCa08ztDfTqpH0oxAhKM2KMu6vDoFtzvUn5ct E2K8gmPKykjzPg0WYzulEU/UvYaEGo4tx5HxKo5octg5QOKRWcmR3a3jV2qEi+GjngzR PRU3KcoU+e5ithhpqntI8AcXC6GTzTbxQLFkjrBBzUhFH0u0c4Nww6UVTegdnUXi7quz 6N4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dcaUdCPe; 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 qb24-20020a1709077e9800b00710c5277c64si12911616ejc.768.2022.06.27.16.22.51; Mon, 27 Jun 2022 16:23:16 -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=dcaUdCPe; 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 S241888AbiF0XTM (ORCPT + 99 others); Mon, 27 Jun 2022 19:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241627AbiF0XRW (ORCPT ); Mon, 27 Jun 2022 19:17:22 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E173523BC4 for ; Mon, 27 Jun 2022 16:17:18 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id i8-20020a17090aee8800b001ecc929d14dso11135521pjz.0 for ; Mon, 27 Jun 2022 16:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UfpGy5tAS73+sWM9gF7ZBJ3p3zHT7pkTPz/eUsHxpcI=; b=dcaUdCPejyAkT3avAyglqGr7MqNZ5eKZYM5/Uz4+a8chd/ag+waBxUPMVRuW0zcxE6 PaSo/TML+OWIcqh36qorQYlV18WpR127C39WYyy8GgAii1jUJHgWZaiQIPu+mk0ms0y3 Ef68PLPXfEsVzi/tV/u9eH69F6vTBJEMl3PXw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UfpGy5tAS73+sWM9gF7ZBJ3p3zHT7pkTPz/eUsHxpcI=; b=hYbYzdUevdFs4QrqYBEpexpmqbMngNk7MGZtJsFJjb3ZaSsszjEe1KjbDyfl+uffKx ICQQdZC4IxMEZW24Pt7ysN3ySFknnd8TIT/koMIGToRU3lDepnAMZc7S/rXeFNoEqsM2 +BP/5AGBPQp3vAHpqWuxV0S7Alif4FlsYlJTOoiPIGADarh0Wujf5jRGCDQn8crAXUpH 4jvJav2UVjJgTSjCDFO08DOf4R2LMpAIY/W/10qHh+Ff5ArZByDQQaEs6yCK/1YIgkfr CDTr4t+lMaVBdw8IBdRHRBtUu/dqzyM4ZGBg8YGR7bRN422APrzZPpKsvVUIYJlRCQiy WQrw== X-Gm-Message-State: AJIora9Rmuiu7tQRNMqO2UKK7yse2dYAfX62mNjQsfVbVU1tAfnPLXah F7cbGcam5V5ZD9xFokJ69OVfJg== X-Received: by 2002:a17:90b:1a81:b0:1ed:3c0:3abb with SMTP id ng1-20020a17090b1a8100b001ed03c03abbmr18859689pjb.5.1656371838412; Mon, 27 Jun 2022 16:17:18 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:18c2:6594:17be:c241]) by smtp.gmail.com with ESMTPSA id g207-20020a6252d8000000b0050dc762817esm7929148pfb.88.2022.06.27.16.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 16:17:18 -0700 (PDT) From: Douglas Anderson To: Bjorn Andersson Cc: Douglas Anderson , Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: qcom: cmd-db: replace strscpy_pad() with strncpy() Date: Mon, 27 Jun 2022 16:17:00 -0700 Message-Id: <20220627161642.1.Ie7b480cd99e2c13319220cbc108caf2bcd41286b@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- drivers/soc/qcom/cmd-db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index c5137c25d819..0aafe90277bc 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -141,14 +141,14 @@ static int cmd_db_get_header(const char *id, const struct entry_header **eh, const struct rsc_hdr *rsc_hdr; const struct entry_header *ent; int ret, i, j; - u8 query[8]; + u8 query[8] __nonstring; ret = cmd_db_ready(); if (ret) return ret; /* Pad out query string to same length as in DB */ - strscpy_pad(query, id, sizeof(query)); + strncpy(query, id, sizeof(query)); for (i = 0; i < MAX_SLV_ID; i++) { rsc_hdr = &cmd_db_header->header[i]; -- 2.37.0.rc0.161.g10f37bed90-goog