From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1BB2EA0548; Sun, 28 Nov 2021 14:14:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C13B4068E; Sun, 28 Nov 2021 14:14:34 +0100 (CET) Received: from smail.rz.tu-ilmenau.de (smail.rz.tu-ilmenau.de [141.24.186.67]) by mails.dpdk.org (Postfix) with ESMTP id C16B74068A for ; Sun, 28 Nov 2021 14:14:33 +0100 (CET) Received: from isengard.fritz.box (unknown [87.147.61.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 68AC8580060; Sun, 28 Nov 2021 14:14:33 +0100 (CET) From: Markus Theil To: ferruh.yigit@intel.com Cc: dev@dpdk.org, markus.theil@secunet.com, Michael Pfeiffer Subject: [PATCH v2] kni: fix ioctl signature Date: Sun, 28 Nov 2021 14:14:26 +0100 Message-Id: <20211128131426.68238-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Markus Theil Fix kni's ioctl signature to correctly match the kernel's structs. This shaves off the (void*) casts and uses struct file* instead of struct inode*. With the correct signature, control flow integrity checkers are no longer confused at this point. Signed-off-by: Markus Theil Tested-by: Michael Pfeiffer --- v2: adapt to suggestions from Ferruh Yigit kernel/linux/kni/kni_misc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c index f10dcd069d..8d56006512 100644 --- a/kernel/linux/kni/kni_misc.c +++ b/kernel/linux/kni/kni_misc.c @@ -482,10 +482,10 @@ kni_ioctl_release(struct net *net, uint32_t ioctl_num, return ret; } -static int -kni_ioctl(struct inode *inode, uint32_t ioctl_num, unsigned long ioctl_param) +static long +kni_ioctl(struct file *file, uint32_t ioctl_num, unsigned long ioctl_param) { - int ret = -EINVAL; + long ret = -EINVAL; struct net *net = current->nsproxy->net_ns; pr_debug("IOCTL num=0x%0x param=0x%0lx\n", ioctl_num, ioctl_param); @@ -511,8 +511,8 @@ kni_ioctl(struct inode *inode, uint32_t ioctl_num, unsigned long ioctl_param) return ret; } -static int -kni_compat_ioctl(struct inode *inode, uint32_t ioctl_num, +static long +kni_compat_ioctl(struct file *file, uint32_t ioctl_num, unsigned long ioctl_param) { /* 32 bits app on 64 bits OS to be supported later */ @@ -525,8 +525,8 @@ static const struct file_operations kni_fops = { .owner = THIS_MODULE, .open = kni_open, .release = kni_release, - .unlocked_ioctl = (void *)kni_ioctl, - .compat_ioctl = (void *)kni_compat_ioctl, + .unlocked_ioctl = kni_ioctl, + .compat_ioctl = kni_compat_ioctl, }; static struct miscdevice kni_misc = { -- 2.34.1