xref: /third_party/ltp/testcases/kernel/syscalls/uname/uname02.c (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/testcases/kernel/syscalls/uname/
1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci *
4f08c3bdfSopenharmony_ci * Copyright (c) International Business Machines  Corp., 2001
5f08c3bdfSopenharmony_ci *
6f08c3bdfSopenharmony_ci * Basic test for uname():
7f08c3bdfSopenharmony_ci * Calling uname() with invalid buf got EFAULT.
8f08c3bdfSopenharmony_ci *
9f08c3bdfSopenharmony_ci */
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ci#include <errno.h>
12f08c3bdfSopenharmony_ci#include <sys/utsname.h>
13f08c3bdfSopenharmony_ci#include "tst_test.h"
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_cistatic void *bad_addr;
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_cistatic void verify_uname(void)
18f08c3bdfSopenharmony_ci{
19f08c3bdfSopenharmony_ci	TST_EXP_FAIL(uname(bad_addr), EFAULT);
20f08c3bdfSopenharmony_ci}
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_cistatic void setup(void)
23f08c3bdfSopenharmony_ci{
24f08c3bdfSopenharmony_ci	bad_addr = tst_get_bad_addr(NULL);
25f08c3bdfSopenharmony_ci}
26f08c3bdfSopenharmony_ci
27f08c3bdfSopenharmony_cistatic struct tst_test test = {
28f08c3bdfSopenharmony_ci	.test_all = verify_uname,
29f08c3bdfSopenharmony_ci	.setup = setup,
30f08c3bdfSopenharmony_ci};
31

Indexes created Thu Nov 07 10:32:03 CST 2024