Skip to content

Commit 7789bf0

Browse files
arndbaxboe
authored andcommitted
floppy: fix function pointer cast warnings
clang-16 complains about a control flow integrity (kcfi) violation casting between incompatible pointers: drivers/block/floppy.c:2001:11: error: cast from 'void (*)(void)' to 'done_f' (aka 'void (*)(int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 2001 | .done = (done_f)empty | ^~~~~~~~~~~~~ Just add another empty function with the correct prototype as a workaround. The warning is for code that was added before the start of the normal git history, but I tracked it done to an early change in the reconstructed linux-history.git. Fixes: 598a477afe06 ("Import 1.1.41") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20240213095918.455478-1-arnd@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 921e81d commit 7789bf0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/block/floppy.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,13 @@ static struct format_descr format_req;
530530
static char *floppy_track_buffer;
531531
static int max_buffer_sectors;
532532

533-
typedef void (*done_f)(int);
534533
static const struct cont_t {
535534
void (*interrupt)(void);
536535
/* this is called after the interrupt of the
537536
* main command */
538537
void (*redo)(void); /* this is called to retry the operation */
539538
void (*error)(void); /* this is called to tally an error */
540-
done_f done; /* this is called to say if the operation has
539+
void (*done)(int); /* this is called to say if the operation has
541540
* succeeded/failed */
542541
} *cont;
543542

@@ -985,6 +984,10 @@ static void empty(void)
985984
{
986985
}
987986

987+
static void empty_done(int result)
988+
{
989+
}
990+
988991
static void (*floppy_work_fn)(void);
989992

990993
static void floppy_work_workfn(struct work_struct *work)
@@ -1998,14 +2001,14 @@ static const struct cont_t wakeup_cont = {
19982001
.interrupt = empty,
19992002
.redo = do_wakeup,
20002003
.error = empty,
2001-
.done = (done_f)empty
2004+
.done = empty_done,
20022005
};
20032006

20042007
static const struct cont_t intr_cont = {
20052008
.interrupt = empty,
20062009
.redo = process_fd_request,
20072010
.error = empty,
2008-
.done = (done_f)empty
2011+
.done = empty_done,
20092012
};
20102013

20112014
/* schedules handler, waiting for completion. May be interrupted, will then

0 commit comments

Comments
 (0)