Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp453209rdb; Sat, 17 Feb 2024 17:26:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUAs16//IZpThxBf8bFk5Bm3R6KeFIzkUyrO8R0fsKu8sIUSyOauuMmddF/dgcQX74EiQ0dZ/luDwcj/ImX6vZZDM7HfM3XZB1O5M1EQQ== X-Google-Smtp-Source: AGHT+IGuOtCrCIISBnvGe3vOBT0jeOJXkP6J57uow4JHRbVpVAdeIUF6aHCgoGcOgpGGypI09H06 X-Received: by 2002:a0c:f5cf:0:b0:68f:42c1:3b90 with SMTP id q15-20020a0cf5cf000000b0068f42c13b90mr3462183qvm.37.1708219568056; Sat, 17 Feb 2024 17:26:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708219568; cv=pass; d=google.com; s=arc-20160816; b=AB0PD2jLWZz5Yn7yzbmdeGiihXTGVMMhLMcOgNw/klcXTpmCcl3Msbrpkw3vA4PoiU yt+Rzgmmme6inf4kUNqBjOZU6sGV80e2ogmimMORuvSCWcOo2tjCg8QFRI7/0aet/1fy 45fYtbCaYEiXTX9CmOTOecEdy2fqLt9fRThKD6C5C8AptIouS/1V9uXbvwid97v6sQqv qKyBXXMzjo1bezqxjluL9IiB1Cig833MwqXPVp1Yd5dQ17rYItrLnpbCNKzbg3b36p/k vs3c3oYz1mzlfLFw/RNNjGojXb0q7ao0rLenVvKs535XAzo3NdiqHEz3VGb/6FmPkqV7 dQ3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=oI0SeXpWVdp8QewLOEszxyKpLJNxGocHOy6dhyWalyU=; fh=HvyDJmLXubiuReBbtZC6OoijOJZN/HZERxW9Qq43qOg=; b=sXOIrUs2Hk774FNNIMGLSek/yalR9rl0TodK6GJSpRuXKHV59yzleaVT2LMM2+KyGL Ch3yDb+VLAW8fQ2PjoJYCSmIkAvg7bi9Kj5hMzFfaN+wKYfn5R1+2guzALLXe5ikci9v VeazBksofdmUk6YV5DtF9wLLOt08tiA49sIYy8YI/Qm4o4aRKno2xRUMmvOlIigeRYlt AHBiozlfHOEDsKWlF4uFb85aVVp0jvJCA+tZfYEwIn33xPHcm15Y1s04MNuvfGmkVZL2 Zg8H06QZFMvfxxRXtOUS4zVlqrFk7DkCPxPK9qjQerAz6ybmoG2RQCaPTLXhNmy1c+9r OYvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-70136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r12-20020ad4576c000000b0068f13883684si3089681qvx.291.2024.02.17.17.26.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 17:26:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-70136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CC10A1C20C8F for ; Sun, 18 Feb 2024 01:26:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 294994C7D; Sun, 18 Feb 2024 01:26:02 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E01574A24 for ; Sun, 18 Feb 2024 01:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708219561; cv=none; b=TavD1s2vuR10laBmDjdTGtP6cVjBu03UA4M0PthMXJn9PsDqhDBrnOEGxs6EKorjiQsAZTWwQUNNxmk5tHkLBFKfpYbrWy+3zT0X4z1jUF2f6ufcFATzsBUZufH63xdvtzqSMHXbU4yh5XqhCxKmaTM5s2KXo89fnrJwIbAIaQ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708219561; c=relaxed/simple; bh=TZjic76A8kuTdFOi//kqSuC2cW56oelgKFo7TvSy1y4=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=MN1DuuTLAvizQZ/cG37cp6TyzxmFGCfdYnFefKvCyhMWu9c9rnSh+yoHkrEmK8slW/0xRPbW3oqyQjs2NHtFb6awvjO3XHdQmMnAy293BEARoDqaM/XEmp+3bkJfl+MzN6d19kv0/547HDoTC8e+i+xSA7dWCKXh04Va2qGaxYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TcnyY2Fwxz1xnZm; Sun, 18 Feb 2024 09:24:37 +0800 (CST) Received: from kwepemm600013.china.huawei.com (unknown [7.193.23.68]) by mail.maildlp.com (Postfix) with ESMTPS id 4193D140157; Sun, 18 Feb 2024 09:25:56 +0800 (CST) Received: from [10.174.178.46] (10.174.178.46) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 18 Feb 2024 09:25:55 +0800 Subject: Re: [PATCH 1/2] ubifs: fix sort function prototype To: Arnd Bergmann , Richard Weinberger , Nathan Chancellor , Adrian Hunter , Artem Bityutskiy CC: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , , , References: <20240213095412.453787-1-arnd@kernel.org> From: Zhihao Cheng Message-ID: Date: Sun, 18 Feb 2024 09:25:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240213095412.453787-1-arnd@kernel.org> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600013.china.huawei.com (7.193.23.68) ?? 2024/2/13 17:54, Arnd Bergmann ะด??: > From: Arnd Bergmann > > The global sort() function expects a callback pointer to a function with two > void* arguments, but ubifs has a function with specific object types, which > causes a warning in clang-16 and higher: > > fs/ubifs/lprops.c:1272:9: error: cast from 'int (*)(struct ubifs_info *, const struct ubifs_lprops *, int, struct ubifs_lp_stats *)' to 'ubifs_lpt_scan_callback' (aka 'int (*)(struct ubifs_info *, const struct ubifs_lprops *, int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] > 1272 | (ubifs_lpt_scan_callback)scan_check_cb, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Change the prototype to the regular one and cast the object pointers > locally instead. > > Fixes: 1e51764a3c2a ("UBIFS: add new flash file system") > Signed-off-by: Arnd Bergmann > --- > fs/ubifs/find.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) Reviewed-by: Zhihao Cheng > > diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c > index 873e6e1c92b5..1cb79b167a4f 100644 > --- a/fs/ubifs/find.c > +++ b/fs/ubifs/find.c > @@ -726,11 +726,10 @@ int ubifs_find_free_leb_for_idx(struct ubifs_info *c) > return err; > } > > -static int cmp_dirty_idx(const struct ubifs_lprops **a, > - const struct ubifs_lprops **b) > +static int cmp_dirty_idx(const void *a, const void *b) > { > - const struct ubifs_lprops *lpa = *a; > - const struct ubifs_lprops *lpb = *b; > + const struct ubifs_lprops *lpa = *(const struct ubifs_lprops **)a; > + const struct ubifs_lprops *lpb = *(const struct ubifs_lprops **)b; > > return lpa->dirty + lpa->free - lpb->dirty - lpb->free; > } > @@ -754,7 +753,7 @@ int ubifs_save_dirty_idx_lnums(struct ubifs_info *c) > sizeof(void *) * c->dirty_idx.cnt); > /* Sort it so that the dirtiest is now at the end */ > sort(c->dirty_idx.arr, c->dirty_idx.cnt, sizeof(void *), > - (int (*)(const void *, const void *))cmp_dirty_idx, NULL); > + cmp_dirty_idx, NULL); > dbg_find("found %d dirty index LEBs", c->dirty_idx.cnt); > if (c->dirty_idx.cnt) > dbg_find("dirtiest index LEB is %d with dirty %d and free %d", >