linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/s390/char/tty3270: Remove function callback casts
@ 2020-06-27 12:54 Oscar Carter
  2020-06-27 16:10 ` Kees Cook
  2020-06-29 11:54 ` Heiko Carstens
  0 siblings, 2 replies; 4+ messages in thread
From: Oscar Carter @ 2020-06-27 12:54 UTC (permalink / raw)
  To: Kees Cook, Heiko Carstens, Vasily Gorbik, Christian Borntraeger
  Cc: kernel-hardening, linux-s390, linux-kernel, Oscar Carter

In an effort to enable -Wcast-function-type in the top-level Makefile to
support Control Flow Integrity builds, remove all the function callback
casts.

To do this modify the function prototypes accordingly.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
 drivers/s390/char/tty3270.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 98d7fc152e32..aec996de44d9 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -556,8 +556,9 @@ tty3270_scroll_backward(struct kbd_data *kbd)
  * Pass input line to tty.
  */
 static void
-tty3270_read_tasklet(struct raw3270_request *rrq)
+tty3270_read_tasklet(unsigned long data)
 {
+	struct raw3270_request *rrq = (struct raw3270_request *)data;
 	static char kreset_data = TW_KR;
 	struct tty3270 *tp = container_of(rrq->view, struct tty3270, view);
 	char *input;
@@ -652,8 +653,9 @@ tty3270_issue_read(struct tty3270 *tp, int lock)
  * Hang up the tty
  */
 static void
-tty3270_hangup_tasklet(struct tty3270 *tp)
+tty3270_hangup_tasklet(unsigned long data)
 {
+	struct tty3270 *tp = (struct tty3270 *)data;
 	tty_port_tty_hangup(&tp->port, true);
 	raw3270_put_view(&tp->view);
 }
@@ -752,11 +754,9 @@ tty3270_alloc_view(void)

 	tty_port_init(&tp->port);
 	timer_setup(&tp->timer, tty3270_update, 0);
-	tasklet_init(&tp->readlet,
-		     (void (*)(unsigned long)) tty3270_read_tasklet,
+	tasklet_init(&tp->readlet, tty3270_read_tasklet,
 		     (unsigned long) tp->read);
-	tasklet_init(&tp->hanglet,
-		     (void (*)(unsigned long)) tty3270_hangup_tasklet,
+	tasklet_init(&tp->hanglet, tty3270_hangup_tasklet,
 		     (unsigned long) tp);
 	INIT_WORK(&tp->resize_work, tty3270_resize_work);

--
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/s390/char/tty3270: Remove function callback casts
  2020-06-27 12:54 [PATCH] drivers/s390/char/tty3270: Remove function callback casts Oscar Carter
@ 2020-06-27 16:10 ` Kees Cook
  2020-07-04 12:25   ` Oscar Carter
  2020-06-29 11:54 ` Heiko Carstens
  1 sibling, 1 reply; 4+ messages in thread
From: Kees Cook @ 2020-06-27 16:10 UTC (permalink / raw)
  To: Oscar Carter
  Cc: Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	kernel-hardening, linux-s390, linux-kernel

On Sat, Jun 27, 2020 at 02:54:17PM +0200, Oscar Carter wrote:
> In an effort to enable -Wcast-function-type in the top-level Makefile to
> support Control Flow Integrity builds, remove all the function callback
> casts.
> 
> To do this modify the function prototypes accordingly.
> 
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>

Oh yes, the tasklets! I'd love to see this fixed correctly. (Which is to
say, modernize the API.) Romain hasn't had time to continue the work:
https://lore.kernel.org/kernel-hardening/20190929163028.9665-1-romain.perier@gmail.com/

Is this something you'd want to tackle?

> ---
>  drivers/s390/char/tty3270.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
> index 98d7fc152e32..aec996de44d9 100644
> --- a/drivers/s390/char/tty3270.c
> +++ b/drivers/s390/char/tty3270.c
> @@ -556,8 +556,9 @@ tty3270_scroll_backward(struct kbd_data *kbd)
>   * Pass input line to tty.
>   */
>  static void
> -tty3270_read_tasklet(struct raw3270_request *rrq)
> +tty3270_read_tasklet(unsigned long data)
>  {
> +	struct raw3270_request *rrq = (struct raw3270_request *)data;

Regardless, this is correct as far as fixing the prototype.

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/s390/char/tty3270: Remove function callback casts
  2020-06-27 12:54 [PATCH] drivers/s390/char/tty3270: Remove function callback casts Oscar Carter
  2020-06-27 16:10 ` Kees Cook
@ 2020-06-29 11:54 ` Heiko Carstens
  1 sibling, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2020-06-29 11:54 UTC (permalink / raw)
  To: Oscar Carter
  Cc: Kees Cook, Vasily Gorbik, Christian Borntraeger,
	kernel-hardening, linux-s390, linux-kernel

On Sat, Jun 27, 2020 at 02:54:17PM +0200, Oscar Carter wrote:
> In an effort to enable -Wcast-function-type in the top-level Makefile to
> support Control Flow Integrity builds, remove all the function callback
> casts.
> 
> To do this modify the function prototypes accordingly.
> 
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
> ---
>  drivers/s390/char/tty3270.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/s390/char/tty3270: Remove function callback casts
  2020-06-27 16:10 ` Kees Cook
@ 2020-07-04 12:25   ` Oscar Carter
  0 siblings, 0 replies; 4+ messages in thread
From: Oscar Carter @ 2020-07-04 12:25 UTC (permalink / raw)
  To: Kees Cook
  Cc: Oscar Carter, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, kernel-hardening, linux-s390,
	linux-kernel

On Sat, Jun 27, 2020 at 09:10:56AM -0700, Kees Cook wrote:
> On Sat, Jun 27, 2020 at 02:54:17PM +0200, Oscar Carter wrote:
> > In an effort to enable -Wcast-function-type in the top-level Makefile to
> > support Control Flow Integrity builds, remove all the function callback
> > casts.
> >
> > To do this modify the function prototypes accordingly.
> >
> > Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
>
> Oh yes, the tasklets! I'd love to see this fixed correctly. (Which is to
> say, modernize the API.) Romain hasn't had time to continue the work:
> https://lore.kernel.org/kernel-hardening/20190929163028.9665-1-romain.perier@gmail.com/
>
> Is this something you'd want to tackle?

Yes, of course. It will be a pleasure to work on this. But without forgetting
the work to remove all the function cast mismatches.

> > ---
> >  drivers/s390/char/tty3270.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
> > index 98d7fc152e32..aec996de44d9 100644
> > --- a/drivers/s390/char/tty3270.c
> > +++ b/drivers/s390/char/tty3270.c
> > @@ -556,8 +556,9 @@ tty3270_scroll_backward(struct kbd_data *kbd)
> >   * Pass input line to tty.
> >   */
> >  static void
> > -tty3270_read_tasklet(struct raw3270_request *rrq)
> > +tty3270_read_tasklet(unsigned long data)
> >  {
> > +	struct raw3270_request *rrq = (struct raw3270_request *)data;
>
> Regardless, this is correct as far as fixing the prototype.
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> --
> Kees Cook

Regards,
Oscar Carter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-04 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 12:54 [PATCH] drivers/s390/char/tty3270: Remove function callback casts Oscar Carter
2020-06-27 16:10 ` Kees Cook
2020-07-04 12:25   ` Oscar Carter
2020-06-29 11:54 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).