Skip to content

Commit e7e1cc1

Browse files
Ming Leiaxboe
authored andcommitted
selftests/ublk: fix garbage output in foreground mode
Initialize _evtfd to -1 in struct dev_ctx to prevent garbage output when running kublk in foreground mode. Without this, _evtfd is zero-initialized to 0 (stdin), and ublk_send_dev_event() writes binary data to stdin which appears as garbage on the terminal. Also fix debug message format string. Fixes: 6aecda0 ("selftests: ublk: add kernel selftests for ublk") Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 23e62cf commit e7e1cc1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • tools/testing/selftests/ublk

tools/testing/selftests/ublk/kublk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ static int __cmd_dev_add(const struct dev_ctx *ctx)
12741274
}
12751275

12761276
ret = ublk_start_daemon(ctx, dev);
1277-
ublk_dbg(UBLK_DBG_DEV, "%s: daemon exit %d\b", ret);
1277+
ublk_dbg(UBLK_DBG_DEV, "%s: daemon exit %d\n", __func__, ret);
12781278
if (ret < 0)
12791279
ublk_ctrl_del_dev(dev);
12801280

@@ -1620,6 +1620,7 @@ int main(int argc, char *argv[])
16201620
int option_idx, opt;
16211621
const char *cmd = argv[1];
16221622
struct dev_ctx ctx = {
1623+
._evtfd = -1,
16231624
.queue_depth = 128,
16241625
.nr_hw_queues = 2,
16251626
.dev_id = -1,

0 commit comments

Comments
 (0)