From patchwork Sun Nov 14 20:43:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12618423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C427C433EF for ; Sun, 14 Nov 2021 20:44:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4664660FE8 for ; Sun, 14 Nov 2021 20:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236321AbhKNUq4 (ORCPT ); Sun, 14 Nov 2021 15:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236299AbhKNUqk (ORCPT ); Sun, 14 Nov 2021 15:46:40 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3DCAC061746; Sun, 14 Nov 2021 12:43:43 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id y196so12157753wmc.3; Sun, 14 Nov 2021 12:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kP3xYHTgf3xiqvDKR6oSKFaK/9w+EGSR3L/Lkf7VsQI=; b=lAzy2bWFZq2Zin54Yg0kAwXMjeDJEtweIebrF0xO0GOO5NkHV9312Jc288Cwori1Zy w4/jfkpbR4SokHguodLQe/jJanwzQcFAiCtkdUBCYp/PaSjfSWD6Dgz4CdLiBu+BUmpC MjfM9w37cJxk69Aj08wuJt3vvrgR2iOL2jUKUsw636ECbOuuvNX/pVc8BTPMDaQoHfEr smeftQSGueZY3A3eAsZW948Ljshe+dMcHL9qrPLCXVkySn2o+pDpZK2CqxwlIi16bdAl 04t3eLPDXEHJN5n4Ikwsgton6LveXaEgb6SmSWaxn3WrUdZ6OdlfVbG78Mr0RocCc57K fU+g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kP3xYHTgf3xiqvDKR6oSKFaK/9w+EGSR3L/Lkf7VsQI=; b=Kovgo+VgIoH/GfJWec7wEsQqo/ZRv6GiJAV19I5PTSqZbcO31wCqLTwWh9NI6/YlzD LgW9cqX3b7RB6WapUgIMuGqHFTsa/7bRMNBa68kkCqrWMRuIDctvERZPfzvKHY+M4gl1 12IyyaIN0y737HVCuC4+iP0XDgppO5XUPT8flUFDnKMh8sP9515ZzCLqToIeb+/jQmMW iFZkxmpXYQa9slbY4XDAc2US8B3ic8IVoBiks4V/Egesjl4C7VFu8c4ZHj4Akm7RHk2s 7eBqvaDQkEs+oCHEElKYh1meWlXcULJ2ySBrhIPxma797cx0DeQ8e8KKN6GUiTIQE/66 LYzQ== X-Gm-Message-State: AOAM531WV2/qcSov8X1x/GRT7cZTEwchnymUIVbw/3Ek+pEBbDXMooeN qnvvGpUqqptDoCPreYZcuSA= X-Google-Smtp-Source: ABdhPJxeTDf5dBMTjMgL/1GC8axroAWjiyIS35II9SYiAeyu3WJ3ec4+ujpo1+0qwcLPOUbFyQFNog== X-Received: by 2002:a7b:c2a1:: with SMTP id c1mr5103680wmk.112.1636922622505; Sun, 14 Nov 2021 12:43:42 -0800 (PST) Received: from ubuntu-laptop.speedport.ip (p200300e94719c9aa03f58ab728c81581.dip0.t-ipconnect.de. [2003:e9:4719:c9aa:3f5:8ab7:28c8:1581]) by smtp.gmail.com with ESMTPSA id m14sm16673630wrp.28.2021.11.14.12.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Nov 2021 12:43:42 -0800 (PST) From: Bean Huo To: ulf.hansson@linaro.org, adrian.hunter@intel.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: beanhuo@micron.com Subject: [PATCH v1 1/2] mmc-utils: Use memcpy instead of strncpy Date: Sun, 14 Nov 2021 21:43:30 +0100 Message-Id: <20211114204331.39555-2-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211114204331.39555-1-huobean@gmail.com> References: <20211114204331.39555-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bean Huo The -Wstringop-truncation warning added in GCC 8.0: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82944 If you use the GCC > v8.0, you probably will get this compilation error: error: ‘__builtin_strncpy’ output may be truncated copying 8 bytes from a string of length 511 [-Werror=stringop-truncation] Use memcpy instead of strncpy to avoid this compilation error. Signed-off-by: Bean Huo --- mmc_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmc_cmds.c b/mmc_cmds.c index 205e6e5b89f9..ecbde3937c81 100644 --- a/mmc_cmds.c +++ b/mmc_cmds.c @@ -1835,7 +1835,8 @@ int do_read_extcsd(int nargs, char **argv) if (ext_csd_rev >= 7) { memset(lbuf, 0, sizeof(lbuf)); - strncpy(lbuf, (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION], 8); + memcpy(lbuf, (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION], 8); + lbuf[8] = '\0'; printf("eMMC Firmware Version: %s\n", lbuf); printf("eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x%02x\n", ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]); From patchwork Sun Nov 14 20:43:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12618421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DBE2C433F5 for ; Sun, 14 Nov 2021 20:44:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 323576112E for ; Sun, 14 Nov 2021 20:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236303AbhKNUqw (ORCPT ); Sun, 14 Nov 2021 15:46:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236292AbhKNUqk (ORCPT ); Sun, 14 Nov 2021 15:46:40 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6898FC061766; Sun, 14 Nov 2021 12:43:44 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id y84-20020a1c7d57000000b00330cb84834fso14163479wmc.2; Sun, 14 Nov 2021 12:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t59DxpPWwMue5RvBJJrR6c6rMf+S15IuR0boHpCGISA=; b=cn37UUnd7mty4NkCYRYIU//vLJq1dSG3j7qZ96s7YdtNV7vRNjxw0F9QcEcB85JoNH tC1vVd3eOBLoyXqYVRIlAvGamCjJirmU7NIrBqOIHQvAOVGjwOvUS7aGtgNjq1faboqw nLE/O8oVh+23c65OsIzJIMiV4hFychbMO2tyosHj8RlpHj4BlXQ9PWDnoRQ4myGtt98o VHMbl2WrKOKLFGIR7hTsX01LSlVWR6qLytbZ8p73xI+Yq8FpZykoWhfcDjVvNDef6PqD VJ4pWGUM3FQNnITEDjBfimHvJ1x8u3Vh6sEU9KKsAGO874s2u+C6ryXQWJMi5N86K0rj YtRA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=t59DxpPWwMue5RvBJJrR6c6rMf+S15IuR0boHpCGISA=; b=LFbd67ICr1e0k8lEREcIuT+tLm6g+VF9kWVCEYnVSfzbfAMOuN2eOIpgxcskwYGEGm Who1nVfJkem9ZloADDMaK/4xWBkiSPH5nD1PJILyRPT3lSZytvNlSR2te7rYYxJq8iM6 kC5p2hEmNNVcvkDCJf+K8QRKs8Z5aJKciqVnTt0XcPD63vuqrC7QBPITdco4iJf1Fn8e 0FIMFSJZMdzIxPoJLJ2wYxAIa3//pBsFnrcOnzS2NLuu5EBQWucpnek/hzlXWdcot6m6 upzX6fUdEg9iX9pCAq2/0QwnbEG0tHwHPD5FYvDAxAB0mDPOzPlA31icAv2xp829EN0S RCgg== X-Gm-Message-State: AOAM531lO0NKHmrjotKfTZrnkiDuxmSoIe1Aj9b4IADB0Vh6ZsJB4XRk kKZkLbNVhVZFhZyTaoCdi3t2klw0/BEKGKcs X-Google-Smtp-Source: ABdhPJxxIBImxTmgseQ+6VqtwL3Fb0QWxrp5KN8gOzH9i1PhXGIzrVNDfbAiXDoJv3QZsLH6GEucPQ== X-Received: by 2002:a05:600c:299:: with SMTP id 25mr5940634wmk.77.1636922623126; Sun, 14 Nov 2021 12:43:43 -0800 (PST) Received: from ubuntu-laptop.speedport.ip (p200300e94719c9aa03f58ab728c81581.dip0.t-ipconnect.de. [2003:e9:4719:c9aa:3f5:8ab7:28c8:1581]) by smtp.gmail.com with ESMTPSA id m14sm16673630wrp.28.2021.11.14.12.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Nov 2021 12:43:42 -0800 (PST) From: Bean Huo To: ulf.hansson@linaro.org, adrian.hunter@intel.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: beanhuo@micron.com Subject: [PATCH v1 2/2] mmc-utils: Add note for CMDQ_MODE_EN runtime value Date: Sun, 14 Nov 2021 21:43:31 +0100 Message-Id: <20211114204331.39555-3-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211114204331.39555-1-huobean@gmail.com> References: <20211114204331.39555-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bean Huo Since the Linux kernel commit 70b52f090805 ("mmc: block: Disable CMDQ on the ioctl path"), CMDQ in CMDQ_MODE_EN[15] is disabled before reading EXT_CSD. Therefore, it is more accurate to use sysfs node to check CMDQ_MODE_EN value. Add a note print to highlight. Signed-off-by: Bean Huo Acked-by: Avri Altman --- mmc_cmds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmc_cmds.c b/mmc_cmds.c index ecbde3937c81..46c5f5faae02 100644 --- a/mmc_cmds.c +++ b/mmc_cmds.c @@ -1885,6 +1885,8 @@ int do_read_extcsd(int nargs, char **argv) (ext_csd[EXT_CSD_CMDQ_DEPTH] & 0x1f) + 1); printf("Command Enabled [CMDQ_MODE_EN]: 0x%02x\n", ext_csd[EXT_CSD_CMDQ_MODE_EN]); + printf("Note: CMDQ_MODE_EN may not indicate the runtime CMDQ ON or OFF.\n" + "Please check sysfs node '/sys/devices/.../mmc_host/mmcX/mmcX:XXXX/cmdq_en'\n"); } out_free: return ret;