From patchwork Sat Jul 1 05:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Ming X-Patchwork-Id: 13298873 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2C4AEB64DC for ; Sat, 1 Jul 2023 05:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbjGAF45 (ORCPT ); Sat, 1 Jul 2023 01:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjGAF44 (ORCPT ); Sat, 1 Jul 2023 01:56:56 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2103.outbound.protection.outlook.com [40.107.255.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7272118; Fri, 30 Jun 2023 22:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNu/gZ5hvIbjBFlci3FpwavLNAl2C8z/L+K8E/Zb3Tk7EUsEYGiYRPmYik+t2OjoD/tHFnhx3vR2RDA8MimGjJYLSvfOgYr1w5zHaNQ4p4YHJGA+HjriKZ2lQkSW+kKF9He/B9IuDQz0Mg4RYGqubCv9dXLx1wQUFohmXZHUTATFJvb0eLO7nhi3fD9J2X5oGD1zIZ9Tx62nGLgb3bx2vk8sqSMOqoRh4APuPoYmTiqNUPfmC5E0DE+aUwNyh3+8g5QV/XYMtGXi1ylfM0BKABaZeQkRNQTZEAu5O+1MfmwTiJPXr6696nP1e22gIjQrmZnaExwY5IbG0LlNHB7fYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L8xEEespGlpEHl+lvaqbI/NYigMOE2yrhOQstQMZ23g=; b=SRVA8/z6rLAh76TpIEM+oUXPuSbMBPAY9MoyqUcbUSMAXYOwWBSvzXjxjKzByJMTvKM6dL5U63YgYKug710WR1iKI/WEkmjqI0SCbT+t6rz08UOGQ3GO8WKPhV39zAY+PoWQyO2RiGdiHBu7QaA22fO5GvLJH7To5ArEElMzJ4vs8wtBBwtPAm7xRh50tj11zjN/s5ISUioCZkv+aT2yS40L0xQZK4vjrapDmzp4EccEbtuwD1l8grouGca5KIgsJR11fL5WQtN/PCulimFY92VDnSAwFIsX7cOP1EK3q8gR0gLSCUtSvWfy/UI4zhoRm3trABO5IK68TeIEpTMMpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L8xEEespGlpEHl+lvaqbI/NYigMOE2yrhOQstQMZ23g=; b=L3ZcNbF9HJyn3HMAaS4DJ/Vyuh1cWeKeE5X2CUxFYxLreyJOTaVDrwOvQnUs8VIXEjPoPbE0uIQXeIa+1nouWV/3bDP8q+pcPW/X/2svCcQIGIvFxGeHZtxgXF/pQyBFTcwM9qnMA21r8ASMT53izrJtMHAdy8A6KUbB97S8X4FU6a4eCl0iodBnxbxcGRbDYbyCmb/71gKRBa49ZZAuXDJo08lja/7bsJQK/2q5iejKi1Iy8T80aqOpc0Je090dgdTa+49UtIvUNV4iH9671GzTj1D95D7EJZ7FPbsNYh6vkPZyTXVWc5wpQToNNBN8kxoP+H3RUtixb8kwUuoDdA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SG2PR06MB3743.apcprd06.prod.outlook.com (2603:1096:4:d0::18) by TY0PR06MB5659.apcprd06.prod.outlook.com (2603:1096:400:275::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Sat, 1 Jul 2023 05:56:49 +0000 Received: from SG2PR06MB3743.apcprd06.prod.outlook.com ([fe80::7dfd:a3ed:33ca:9cc8]) by SG2PR06MB3743.apcprd06.prod.outlook.com ([fe80::7dfd:a3ed:33ca:9cc8%6]) with mapi id 15.20.6544.019; Sat, 1 Jul 2023 05:56:49 +0000 From: Wang Ming To: Namjae Jeon , Steve French , Sergey Senozhatsky , Tom Talpey , linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Wang Ming Subject: [PATCH v1] fs:smb:Fix unsigned expression compared with zero Date: Sat, 1 Jul 2023 13:55:45 +0800 Message-Id: <20230701055556.23632-1-machel@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: TYCPR01CA0043.jpnprd01.prod.outlook.com (2603:1096:405:1::31) To SG2PR06MB3743.apcprd06.prod.outlook.com (2603:1096:4:d0::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PR06MB3743:EE_|TY0PR06MB5659:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b8d48ed-ff7b-4b72-9906-08db79f7f4d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aGFy6VoiiCh7QUOmCaHyGliWsOkxk8W74sav0KE45cX9rUc9OUQCrMGfj2wCEUVHZOwX8+BbrP1t9ahlplE8ocS8cBx32/dAs0XWuQzT27LC5tHFA98lbQIU+pSJLytQrT88V6M3WPZyuEtKyAM29rwRYFPAW91Q2G4Wc6nWZze2T/nF07hd7cPdBoAZnPrbyFeQhD3hwdcjSljC3hPHF4t7PHlIiaSbRv7HL5Y+L3pbjSsE5ldmum3ZoAjQ7x7XngVFh0Aae/mb+xtRsPBYA0k70++02u7/n8QsYAJ/c/9YtZIxckTJQwqNuqzmzb+4hlOYdMWdbv6aSANwbaPoiorBKjhVopyaYZSa+2IYoBugzD82e/9AzSHA5t2puljhBXm3XA8ubE5aJSfzhXlkICgMssYqvMLc0aZZzA/RJxpXTxwHUj3jQx4bgYOdgc1kCvn+uH6n1ReGsYTdsROcTUxNuu+DMQj5pEulgPkIyAKKLAahOMQo+qeAriCcCjYAteE8FPhkxeSiIXOvBm54V5RkAhQzKPu5vs5n3y5lxoYlmDRfZ1CsikZSY+sPdqpZUMtLY50RD8bKmqJFCdOmV7zIypmVwWdhi4o4ccVs5Ha7qKLTtERx58YQnJSXMP1D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR06MB3743.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199021)(2906002)(41300700001)(5660300002)(8676002)(8936002)(36756003)(86362001)(186003)(2616005)(478600001)(107886003)(26005)(6512007)(6506007)(1076003)(6666004)(52116002)(6486002)(316002)(4326008)(66476007)(66556008)(66946007)(38100700002)(38350700002)(110136005)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fV4QI7sbpkCa6JId/FCQ+63u8FYfMEPZy4AiSoq8XfxZV4qPI7i64yUKtSbdELREwhC5sqBXKpYuB8yH0f7Ef46YnIWwz1D/uG1p9aaCbcV5WnakmDItVUKztrLRkrFpn5eLlISlLesYmfhv1iMH0wDRv+PYP8id68GJY4hCLs+h/ymmcAD+5PN1Z5YmLi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PkZ2xxlWM3SiONHBPnobgXySFHjSFiL3SVWk2o5kqM8qm2YkHeTVXdsYAZEnCorCWSY7db8lmhfIhdebG5du3RzxyUMQErrvPLvlnhtvWAfXbYQubr+9yTEMprod30YI7VjWjzL5bVlmXXWYC7bXFSmRWQxcm/D9Q+bbcm10As9BSWqe58FUiduVi0sr+ZMySOW1iFpBUJ9eyKvi0vqUCH4spcMmGJvehMZZILdaOMa+D+4/iS1ZIeZ/ckDvIVJkTTc8ubkFE0c9jsNtwJ2lYUPFRJr692tkI+jKp8bylm74Z0yEUxsKXko6J36Pmp8TLBEjKLb0jkjz1NUf X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b8d48ed-ff7b-4b72-9906-08db79f7f4d9 X-MS-Exchange-CrossTenant-AuthSource: SG2PR06MB3743.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 05:56:48.3900 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ptWG/zcS82W/UejG36sUqNokgP7T1xtxQ6EwHaFEFUlC6LEsb4iC2szrOlxBf0Njx7EWcGMgVMHoU9ZFGAVWWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5659 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org The return value of the ksmbd_vfs_getcasexattr() is long. However, the return value is being assigned to an unsignef long variable 'v_len',so making 'v_len' to long. Also, when comparing to zero in the following code, no type conversion is required. silence the warning: ./fs/smb/server/vfs.c:WARNING: Unsigned expression compared with zero: v_len > 0 Signed-off-by: Wang Ming Acked-by: Tom Talpey --- fs/smb/server/vfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index e35914457..e605ee96b 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -412,7 +412,8 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, { char *stream_buf = NULL, *wbuf; struct mnt_idmap *idmap = file_mnt_idmap(fp->filp); - size_t size, v_len; + size_t size; + ssize_t v_len; int err = 0; ksmbd_debug(VFS, "write stream data pos : %llu, count : %zd\n", @@ -429,9 +430,9 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, fp->stream.name, fp->stream.size, &stream_buf); - if ((int)v_len < 0) { + if (v_len < 0) { pr_err("not found stream in xattr : %zd\n", v_len); - err = (int)v_len; + err = v_len; goto out; }