Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2580273lqp; Mon, 25 Mar 2024 03:24:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHsDME2+fU8xaaTXXHOcqoXIL6SN5hRhld21mjb+aN7qnsogSGWyYFiEF7QkQNzaoeMz8I0AYy5UuQmkXaJiuqNTkotVll8JvirGbxmA== X-Google-Smtp-Source: AGHT+IEDsLdqWuLkqkAPM4ZMyKi9TWvpNqSW+IvKCs0M4KtjbmtTepAAY23gJ2qwnZkAGKVnkbXR X-Received: by 2002:a17:90a:ee42:b0:29c:403b:ea2e with SMTP id bu2-20020a17090aee4200b0029c403bea2emr4050807pjb.49.1711362260128; Mon, 25 Mar 2024 03:24:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711362260; cv=pass; d=google.com; s=arc-20160816; b=VNjcur4Umbh3U5RET95ywGb+0pSHpZYK4guOrypPus6nlDuki8CWVrcsDNtaC8rBl1 1253KWifyRsIh9OFa9bMaLsiiQPIMyiS8zkwnxc3vs6hR1gLAdCZZltCXqA/qygnGGtL i4yyLMJ6pgLV99v4kgLAf7XvAyaBduYSvZIzxJ4Js4cN5NdZcqZMTJplMuPPKgq8NK2B AT1NgPqnIroW3PE3sMix7UQHs02JaiftyB6GOxIEXadNl9tmSpipZjJpCYgDPOAJ2WYo KFOw0r6YvZTsnErLzY4kzHQww5Ylb12segWWLebI+mlqXId68NLZDNTVdHJJ/Fg7i8XH AEZw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bEf8su/19wbvdgqksWf/1EXAGUvsSyceYmEWNSPxWmY=; fh=lOyx5AzavUiVcpxmMVfcSQxzdUcu4fk1ggU5J5TNGiA=; b=MGgZLoQPP3Df/xiQXQu7lHo5mUi9Kvf3GFGdlwMz6eOV28KV+1B1hK83mLwuQanfl6 N6PmXZPBsfH8B2XK9j/r/TKaUmWxqzqFUwiJ0UvWTHvyeK7aNDAkEBGINGMiea1WZL3w OiPsjy2bSnp6yx0W2nW5ld3A9UmOdzfj07GclYd/Mapb/x19H9dYhh3scSt7e63Pmi0k ZRH+nlVKdwWAOCjwpyaJGLV3n3l+dMlJifZsjyPtgOvs9cJko9f6xp5Q6P0nyy32lvx5 3Il3dIBHrJ1xlm4fq4oKkjk/CewtDZwITb+zoDx05E232jR7JEDLcrAovqcgifvMguNU v1Bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YD+UT+tY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t2-20020a17090aba8200b0029de12e74e0si10911100pjr.33.2024.03.25.03.24.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YD+UT+tY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116186-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A8BC2C2FE0 for ; Mon, 25 Mar 2024 10:24:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4C043B95A6; Mon, 25 Mar 2024 03:33:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YD+UT+tY" 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 23ECD17C6A8; Sun, 24 Mar 2024 23:43:01 +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=1711323781; cv=none; b=CC9FLcBpJ78ZM+5AlHt7xd7hifaSAJDPACI4Y2xmbx1WxUY/vkn2Yvkoq+ScA6Nn29VUC5QwJA/MMwqo9jCsNiX8Z2loYXxXv/hdQ339gGvD06pxp5rb8nPrDahjeHVYkBWqfSUOYwwq69zxGbPhYaBMTr9hfvXBlzEBaNLLyPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323781; c=relaxed/simple; bh=5F+W2XVBb8jBoA1hXh/onNUbYNMRYXAAcVlmlGC3wtQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g4aPI3hTBiggCksP7jqnPmGUJjJuljgAQhD7FuavmrTtf8NiqGLEMk6IXBwpePHJwTJ6Gn+e4xNcrMQHwAYjZucJ/d4NnUKg0ZleGTRp4+yLEkBKUcf/IUQ0wnUDwE2XW7AKvD14TRveGdPCdmBpJ+qF8TCz9U9ufEMFbrkZx70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YD+UT+tY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630A0C43394; Sun, 24 Mar 2024 23:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323781; bh=5F+W2XVBb8jBoA1hXh/onNUbYNMRYXAAcVlmlGC3wtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YD+UT+tYSLsSjlMMV7Stg/4/4kNWpYPTaVQ8BITOZSXF1mQXlam59yGSoTlaYXZi8 uWY8FIwHEmJRr1qYKMk4dFGGIw7Ht2KgHdBzFO0BUYmiB9VVhdrFSCI4BpAAK1qwB6 F0H4f46qxykznYPVgO1FvElxalFl52Lstr8pjQMDR7wMmhTmxe9R1PLGVD/4ihnNd/ HFnlLPZ7eAfDJfUFJube+cd1KuO4D5B0+oYCl60oFqWjXwXcDtQSZjUzM9ukZ82RGf /FjD1Em+cq24G/5KvH2tlgyEcljqAzbA/Ow2LDyVVc20xRwGqmVmYJtDFPpauzqOx7 gTqFQqhr+hyhA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Hans Verkuil , Sasha Levin Subject: [PATCH 5.10 157/238] media: pvrusb2: fix pvr2_stream_callback casts Date: Sun, 24 Mar 2024 19:39:05 -0400 Message-ID: <20240324234027.1354210-158-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Arnd Bergmann [ Upstream commit 30baa4a96b23add91a87305baaeba82c4e109e1f ] clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2, which casts three different prototypes into pvr2_stream_callback: drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*)(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 1070 | pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (*)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 110 | (void (*)(void *))pvr2_context_notify, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(struct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 152 | (pvr2_stream_callback) pvr2_dvb_notify, adap); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change the functions to actually take a void* argument so the cast is no longer needed. Fixes: bb8ce9d9143c ("V4L/DVB (7682): pvrusb2-dvb: finish up stream & buffer handling") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/pvrusb2/pvrusb2-context.c | 8 ++++---- drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 ++++-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c index 1764674de98bc..58f2f3ff10ee2 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-context.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c @@ -90,8 +90,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp) } -static void pvr2_context_notify(struct pvr2_context *mp) +static void pvr2_context_notify(void *ptr) { + struct pvr2_context *mp = ptr; + pvr2_context_set_notify(mp,!0); } @@ -106,9 +108,7 @@ static void pvr2_context_check(struct pvr2_context *mp) pvr2_trace(PVR2_TRACE_CTXT, "pvr2_context %p (initialize)", mp); /* Finish hardware initialization */ - if (pvr2_hdw_initialize(mp->hdw, - (void (*)(void *))pvr2_context_notify, - mp)) { + if (pvr2_hdw_initialize(mp->hdw, pvr2_context_notify, mp)) { mp->video_stream.stream = pvr2_hdw_get_video_stream(mp->hdw); /* Trigger interface initialization. By doing this diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c index 6954584526a32..1b768e7466721 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c @@ -88,8 +88,10 @@ static int pvr2_dvb_feed_thread(void *data) return stat; } -static void pvr2_dvb_notify(struct pvr2_dvb_adapter *adap) +static void pvr2_dvb_notify(void *ptr) { + struct pvr2_dvb_adapter *adap = ptr; + wake_up(&adap->buffer_wait_data); } @@ -149,7 +151,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) } pvr2_stream_set_callback(pvr->video_stream.stream, - (pvr2_stream_callback) pvr2_dvb_notify, adap); + pvr2_dvb_notify, adap); ret = pvr2_stream_set_buffer_count(stream, PVR2_DVB_BUFFER_COUNT); if (ret < 0) return ret; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index c872868becbdc..29f2e767f236f 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -1037,8 +1037,10 @@ static int pvr2_v4l2_open(struct file *file) } -static void pvr2_v4l2_notify(struct pvr2_v4l2_fh *fhp) +static void pvr2_v4l2_notify(void *ptr) { + struct pvr2_v4l2_fh *fhp = ptr; + wake_up(&fhp->wait_data); } @@ -1071,7 +1073,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) hdw = fh->channel.mc_head->hdw; sp = fh->pdi->stream->stream; - pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh); + pvr2_stream_set_callback(sp, pvr2_v4l2_notify, fh); pvr2_hdw_set_stream_type(hdw,fh->pdi->config); if ((ret = pvr2_hdw_set_streaming(hdw,!0)) < 0) return ret; return pvr2_ioread_set_enabled(fh->rhp,!0); -- 2.43.0