Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2946914rdb; Tue, 13 Feb 2024 02:02:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFQMQMWinhM6OunBgB8stMBfMQl5ZDfmEOyzAq1oFixTpKcrfftG9C7dabxVqt1tIBH5W0 X-Received: by 2002:a05:6402:5d84:b0:561:9f1d:40ac with SMTP id if4-20020a0564025d8400b005619f1d40acmr4110286edb.27.1707818524097; Tue, 13 Feb 2024 02:02:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707818524; cv=pass; d=google.com; s=arc-20160816; b=MoE+Faia41HrCX8S2KpmQe7wCPDJL9XQAKYNSzVU3tvntH1+pxb6jaA/yZqljKLs/2 64WXpZhjIUt1RTGUuYLPaj0FUzH/+XkaeFKDy8OivSaN1EKGFY7WdPjB41JEAkh8JiPs JzI2izUeBPZ1wisHrsSk+0Fp4+ZvN3Ex1LpzLkpYJJ8GB5xHnv7J7H8KB4tTfTso2P+P szUNwwN/2WY1KyPO8egsb8SG0fxogvza+foHgkwJ8XWrczbdiBcxrfUMS/pk/4rbTsdV zPHJIIL7sQa04lvawfoPKbfpyJX2AItAL0i2Cx3gL0/Z28r6NF9FRm9J1tzEk9tnJXux +0ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=fepevNIS1TOLm24HDmrdEBAugh3bcOySMPCkdF657YY=; fh=iJYf6W1kzDXQ9szcTqytjweRF1GzSPkYDWZ2K1QNJEM=; b=yMuuitngEUpZ4BT0Le016ViTVBS6D2jPtqMfRGiyAN44cPUForRobjb79ZtnzQFZ2h ikat48meIN93FwCep+Tsy93fEC+lMKGwR4flWF7NTS8faiZ/LG1V+DWyRZfDWioxhQp2 1GTTG6AwwCrm+8XLwQzPEfGGoJ0QVYL1BvlSKL1pc5Hudi20IZrEXG9bkh8VUVB/JlsM 0lYsxo7/HCv5vW3YCZiHq9dkS8cBE7JYBlSKntozPvYJdwMw0Py0awc2eE4ZMCIhW4JW CY8/urrwGo4xuvhDfJHm/jvdozovcFFyztfV6I/K8R46ojW+xpT3e050lcvsGQswa7dR yn9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m2/QZK6n"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWjlEU1IUmNBVksZy0INnDUldmkkQBQqhdsWwP/H7Y1m8g+mup3O8/O8qfRGOBpayRyqnOGfsTqtZFzWFhOVPcPzC0+wpWpEhrCZkg+oQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i21-20020a0564020f1500b00561855e9562si2918748eda.325.2024.02.13.02.02.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m2/QZK6n"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7367E1F2216B for ; Tue, 13 Feb 2024 09:55:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 648AD24A1D; Tue, 13 Feb 2024 09:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m2/QZK6n" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 85450241E5; Tue, 13 Feb 2024 09:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818059; cv=none; b=guj/xtE5c/slJbQ+XPCjhhqKHeZ3hVSijpVW+/vbhNCzNdhX4GyBuZ4jP2EBETK1coOnPtDMQRlocGEC4hVqR0DsEljT/nYaCdlbnnVB0cEK5viLA38sREuDcf2AOzf3J71Fvc6xOoFyScV0d0n7TyHFOp1WUclWQen1CSE15Lg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818059; c=relaxed/simple; bh=tyrKSJ+fpXIRAZe8ycgeQ8Vq9Yq+VZQ5WTyjhUVTRPA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BGJ/zW+VCMmB9SaFWCLT5CdBpDNfwKPzG1DDlPw332kBIDVR7wYVGXmm4Jn2ntuOVMkhczBjTwpkuboTZfQdYIP0LmxTJMeATmZcCFENvHvVRZ2H/t1Da/HRM5LliPfW6zxxkyu9qUsBriY/p/0nJ/TC9y3DNO0PQQxzYsiz09A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m2/QZK6n; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8707AC433C7; Tue, 13 Feb 2024 09:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707818059; bh=tyrKSJ+fpXIRAZe8ycgeQ8Vq9Yq+VZQ5WTyjhUVTRPA=; h=From:To:Cc:Subject:Date:From; b=m2/QZK6nA2S8/E5kGUsVsTSn9C71ihbSd/3BFmOQyQAui7Jb8Sa1MhdrvJnzxLweS irAvGeDMdoCeXu6FjLCaB964QMcwrfLD+Yj5ev+8e3khQ6qMGYyofGPbxAhwJeCXmf yfmIF0qWgYGDCVuOA5liTwZO1YFrHcJODG93j+26y/pt4R8jizxu5oQlqttzahfJtX M6Ln4G2r+tP7S/Dnq5iuSLpx2W6iFtEt2K8PTJsB/8R4v//i2ntTXlnsGbVNwZTz60 goTtSlhokITvTnTMm+bzHzbVn4xKC5/isBKi5DeqYYsU4iS5W6MyyxaOwkvGP6YbuO v/LkRqSB8YDFw== From: Arnd Bergmann To: Richard Weinberger , Nathan Chancellor , Adrian Hunter , Artem Bityutskiy Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/2] ubifs: fix sort function prototype Date: Tue, 13 Feb 2024 10:54:07 +0100 Message-Id: <20240213095412.453787-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) 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", -- 2.39.2