From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B81D7C433E7 for ; Tue, 13 Oct 2020 23:52:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57942221FF for ; Tue, 13 Oct 2020 23:52:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="IUB1fiLX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57942221FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F2DDD6B00CE; Tue, 13 Oct 2020 19:52:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB66F6B00CF; Tue, 13 Oct 2020 19:52:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAB89900002; Tue, 13 Oct 2020 19:52:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id A4F976B00CE for ; Tue, 13 Oct 2020 19:52:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 58EF1181AEF00 for ; Tue, 13 Oct 2020 23:52:41 +0000 (UTC) X-FDA: 77368554522.23.drug00_1f14fd427207 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 35BAB37608 for ; Tue, 13 Oct 2020 23:52:41 +0000 (UTC) X-HE-Tag: drug00_1f14fd427207 X-Filterd-Recvd-Size: 2826 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 13 Oct 2020 23:52:40 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6BCB22201; Tue, 13 Oct 2020 23:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602633160; bh=msPNQ0QQz+eqkzQW7RkXTHrOKFUYQl20vckE/ibwJUo=; h=Date:From:To:Subject:In-Reply-To:From; b=IUB1fiLXtLxJrvjnxHqk8tYM4UPdiGF/X+zPvO587d8kNazvJPL3apSUHzYtKivfm 9btX/9en45lH7u46JYvOlRHz3yI7Mf7/+cbrfyMi3caLeBFEm/MXFVbu94MKm/Ig28 64I6P2PHo/d8MNayY+SlJuCMltqGabFzsg96C2FA= Date: Tue, 13 Oct 2020 16:52:39 -0700 From: Andrew Morton To: akpm@linux-foundation.org, gustavoars@kernel.org, hannes@cmpxchg.org, linux-mm@kvack.org, mhocko@suse.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, vdavydov.dev@gmail.com Subject: [patch 079/181] mm: memcontrol: use the preferred form for passing the size of a structure type Message-ID: <20201013235239.IxuUc59eL%akpm@linux-foundation.org> In-Reply-To: <20201013164658.3bfd96cc224d8923e66a9f4e@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Gustavo A. R. Silva" Subject: mm: memcontrol: use the preferred form for passing the size of a structure type Use the preferred form for passing the size of a structure type. The alternative form where the structure type is spelled out hurts readability and introduces an opportunity for a bug when the object type is changed but the corresponding object identifier to which the sizeof operator is applied is not. Link: https://lkml.kernel.org/r/773e013ff2f07fe2a0b47153f14dea054c0c04f1.1596214831.git.gustavoars@kernel.org Signed-off-by: Gustavo A. R. Silva Acked-by: Michal Hocko Cc: Johannes Weiner Cc: Vladimir Davydov Signed-off-by: Andrew Morton --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memcontrol.c~mm-memcontrol-use-the-preferred-form-for-passing-the-size-of-a-structure-type +++ a/mm/memcontrol.c @@ -4264,7 +4264,7 @@ static int __mem_cgroup_usage_register_e new->entries[size - 1].threshold = threshold; /* Sort thresholds. Registering of new threshold isn't time-critical */ - sort(new->entries, size, sizeof(struct mem_cgroup_threshold), + sort(new->entries, size, sizeof(*new->entries), compare_thresholds, NULL); /* Find current threshold */ _