lkml.org 
[lkml]   [2019]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH linux-kselftest/test v1] apparmor: add AppArmor KUnit tests for policy unpack
    On Thu, Oct 17, 2019 at 5:19 PM Brendan Higgins
    <brendanhiggins@google.com> wrote:

    > +config SECURITY_APPARMOR_TEST
    > + bool "Build KUnit tests for policy_unpack.c"
    > + default n
    > + depends on KUNIT && SECURITY_APPARMOR
    > + help
    >
    select SECURITY_APPARMOR ?
    > + KUNIT_EXPECT_EQ(test, size, TEST_BLOB_DATA_SIZE);
    > + KUNIT_EXPECT_TRUE(test,
    > + memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
    I think this must be KUNIT_ASSERT_EQ(test, size, TEST_BLOB_DATA_SIZE);,
    otherwise there could be a buffer overflow in memcmp. All tests that
    follow such pattern
    are suspect. Also, not sure about your stylistic preference for
    KUNIT_EXPECT_TRUE(test,
    memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
    vs
    KUNIT_EXPECT_EQ(test,
    0,
    memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE));

    \
     
     \ /
      Last update: 2019-10-18 02:34    [W:2.343 / U:1.336 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site