From patchwork Mon Apr 10 09:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 81436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1779109vqo; Mon, 10 Apr 2023 02:38:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bNLUnK4L6kL/AgLNsvGpOIT2p+7L4E9zLhaFhwj/JV4vbrsPsxL060v5opPhl7+nhfK/Om X-Received: by 2002:a05:6a00:15c6:b0:626:9a1:3731 with SMTP id o6-20020a056a0015c600b0062609a13731mr12731200pfu.7.1681119480881; Mon, 10 Apr 2023 02:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681119480; cv=none; d=google.com; s=arc-20160816; b=hzjwpvN8s87RpHuurX8Ri3vk/INPHTPvybb2P3jozXk7UTpgfSbGBk/T6Il+TPYYWs f6fitId9aqi2SqBaViQIqXn02fw9D7gAhuETuHJRwOoT0tyziik7fmejZNJbyGWh8txt CO/XxhXFyEvLd7QtkmIzgTiXXqzVplq4azvdUzpXzZsVgQ3Rz1HXJHW7OzS/FQJdlPVN slyNCvGusIKILXoZVA56mDWubWWEMTkgFLY46VibeKv3nZdaMVeAgRbb53ovMPKn2hy4 EFr3yJUHu7gXao65ENoLPG7KWdP2Et2Aqp0mp/Th9fxGWDhSqkyDyhA1JH5RDCuKLNst 6JEg== 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=jqjHZxrb5JBTsIZioYlzXXMMqB1GQY7z0T9aMHt7oLs=; b=jBwwbJhZyZl0miZ9GcxWa8QzATK/e+XyEsEIabRVEpbC6VDKrxH6rmPOpzfmMfYfgq UcxOrFiFM7f42oP/UoR++iLFX/rfj4t8nrWr/wc4/9dOSnYqWpVWdWknVsshb8J6T69/ lC1fvt2peBJVJyWWw8ROVi4Tlw0lnklKD7z/42ufEp7ysG2zlQ4MGCkgKChQSst/Jq20 lOlpkecwdPJ4z2rt573b93pHb3ENa1rHGKOt28wnkad/iTIEPhGbKUt4Ci3GA/nXoVU5 vIItDPwk82YnTs3rALIOjH2Z+nxtspmDjHct3ckLJxj0l3EuJ0QqGjuEheP5RMvMR/e2 OhrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=GEKMw4T1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a632012000000b0050fa6fbde46si10478285pgg.492.2023.04.10.02.37.48; Mon, 10 Apr 2023 02:38:00 -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=@bytedance.com header.s=google header.b=GEKMw4T1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229878AbjDJJRm (ORCPT + 99 others); Mon, 10 Apr 2023 05:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjDJJRa (ORCPT ); Mon, 10 Apr 2023 05:17:30 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582723C23 for ; Mon, 10 Apr 2023 02:17:05 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-632384298b3so2033373b3a.0 for ; Mon, 10 Apr 2023 02:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1681118225; x=1683710225; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jqjHZxrb5JBTsIZioYlzXXMMqB1GQY7z0T9aMHt7oLs=; b=GEKMw4T1ntCXmJ9aBzvih0LsSJ8WculpHSz/XgPbV9zZSK4KYVqMx/MZn6g/hEKD7c mKBs222LxFznsGXbEa4++UT/hceQwkbBG6HEGPP2OJOma1J34ibNvaHHo+jH8FzHHQ07 EfZSgI4PP0Ng26bOtclVRLF1h95oxCLUnBw1vC+nAztga+Bao0DFJI7qJgjOK61CFIIz YL6akOB8e5uyw84vRXWICSKSjrHm8wTtM7nZb8pbq5/sWE7oT1g/m16zgyQeSKEXjYuc 53C/YVkS+2Dl2PIH2l02FnSRoSxm8GZEvj3owx998fsX7ct+/iUYmgFYKQtxD1z85XcX nOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681118225; x=1683710225; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jqjHZxrb5JBTsIZioYlzXXMMqB1GQY7z0T9aMHt7oLs=; b=nAcNVaxBI7TKAXNiqUluGRDa6SurKxmgVEjrmAb8z9+HXxnxiT9nBkaA3vLZ2uumPV e03uCa65CC4BULp/VrR0jNfjmNiybl4kdb7pVernt1NBkvokH+UhXZrwk+ltZ9OQlMq+ oZor7pzWTN8YJHxuEPIg+rQXVlH7py7maLhYRyMPh8jX7wQPftbSpWLw4WAj9lvNn3k5 RbYf5HmxYKKht0C0dk2l7fBpPnos8D4QO7vJW8B3HD9fY+70zJq/Iqkon3nRsFSzxsHk sgW/GBRXYclJ6olOsX3H3OJ5IPgUgpXRbXJ5Vj8Mq0RosXlxMkyJyTHTkC3AlQq+Q2wv eofQ== X-Gm-Message-State: AAQBX9eHh1Rd0oC86SdXKgnSGMm9OiV7e+1WmDYTfVu+q1qnaDTDCMom 3dyDWdCPTNuHEGXaVw2TcPWDZg== X-Received: by 2002:a62:3086:0:b0:627:f740:51f9 with SMTP id w128-20020a623086000000b00627f74051f9mr10875653pfw.3.1681118224798; Mon, 10 Apr 2023 02:17:04 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([139.177.225.248]) by smtp.gmail.com with ESMTPSA id d18-20020aa78152000000b005d61829db4fsm7314970pfn.168.2023.04.10.02.17.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Apr 2023 02:17:04 -0700 (PDT) From: Peng Zhang To: Liam.Howlett@oracle.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Peng Zhang , David Binderman Subject: [PATCH] maple_tree: Use correct variable type in sizeof Date: Mon, 10 Apr 2023 17:14:31 +0800 Message-Id: <20230410091431.74961-1-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762781541039282405?= X-GMAIL-MSGID: =?utf-8?q?1762781541039282405?= The original code is: memset(pivs + tmp, 0, sizeof(unsigned long *) * (max_p - tmp)); The type of variable pointed to by pivs is unsigned long, but the type used in sizeof is a pointer type. Change it to unsigned long. Suggested-by: David Binderman Signed-off-by: Peng Zhang Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 88c44f6d6cee..b06fc5f19b31 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3255,7 +3255,7 @@ static inline void mas_destroy_rebalance(struct ma_state *mas, unsigned char end if (tmp < max_p) memset(pivs + tmp, 0, - sizeof(unsigned long *) * (max_p - tmp)); + sizeof(unsigned long) * (max_p - tmp)); if (tmp < mt_slots[mt]) memset(slots + tmp, 0, sizeof(void *) * (max_s - tmp));