Lines Matching full:src

44 	char *src;  in lkdtm_FORTIFY_STR_MEMBER()  local
46 src = kmalloc(size, GFP_KERNEL); in lkdtm_FORTIFY_STR_MEMBER()
47 strscpy(src, "over ten bytes", size); in lkdtm_FORTIFY_STR_MEMBER()
48 size = strlen(src) + 1; in lkdtm_FORTIFY_STR_MEMBER()
53 * strncpy(target.a, src, 20); will hit a compile error because the in lkdtm_FORTIFY_STR_MEMBER()
57 strncpy(target.a, src, size); in lkdtm_FORTIFY_STR_MEMBER()
65 kfree(src); in lkdtm_FORTIFY_STR_MEMBER()
109 char *src; in lkdtm_FORTIFY_MEM_MEMBER() local
111 src = kmalloc(size, GFP_KERNEL); in lkdtm_FORTIFY_MEM_MEMBER()
112 strscpy(src, "over ten bytes", size); in lkdtm_FORTIFY_MEM_MEMBER()
113 size = strlen(src) + 1; in lkdtm_FORTIFY_MEM_MEMBER()
118 * strncpy(target.a, src, 20); will hit a compile error because the in lkdtm_FORTIFY_MEM_MEMBER()
122 memcpy(target.a, src, size); in lkdtm_FORTIFY_MEM_MEMBER()
130 kfree(src); in lkdtm_FORTIFY_MEM_MEMBER()
135 * strscpy and generate a panic because there is a write overflow (i.e. src
140 char *src; in lkdtm_FORTIFY_STRSCPY() local
146 char src[5]; in lkdtm_FORTIFY_STRSCPY() member
149 char weird_dst[sizeof(weird.src) + 1]; in lkdtm_FORTIFY_STRSCPY()
151 src = kstrdup("foobar", GFP_KERNEL); in lkdtm_FORTIFY_STRSCPY()
153 if (src == NULL) in lkdtm_FORTIFY_STRSCPY()
157 if (strscpy(dst, src, 0) != -E2BIG) in lkdtm_FORTIFY_STRSCPY()
160 /* Vanilla strscpy returns -E2BIG if src is truncated. */ in lkdtm_FORTIFY_STRSCPY()
161 if (strscpy(dst, src, sizeof(dst)) != -E2BIG) in lkdtm_FORTIFY_STRSCPY()
162 pr_warn("FAIL: strscpy() did not return -E2BIG while src is truncated\n"); in lkdtm_FORTIFY_STRSCPY()
164 /* After above call, dst must contain "foob" because src was truncated. */ in lkdtm_FORTIFY_STRSCPY()
169 /* Shrink src so the strscpy() below succeeds. */ in lkdtm_FORTIFY_STRSCPY()
170 src[3] = '\0'; in lkdtm_FORTIFY_STRSCPY()
176 if (strscpy(dst, src, sizeof(dst)) != 3) in lkdtm_FORTIFY_STRSCPY()
177 pr_warn("FAIL: strscpy() did not return 3 while src was copied entirely truncated\n"); in lkdtm_FORTIFY_STRSCPY()
179 /* After above call, dst must contain "foo" because src was copied. */ in lkdtm_FORTIFY_STRSCPY()
184 /* Test when src is embedded inside a union. */ in lkdtm_FORTIFY_STRSCPY()
185 strscpy(weird_dst, weird.src, sizeof(weird_dst)); in lkdtm_FORTIFY_STRSCPY()
191 /* Restore src to its initial value. */ in lkdtm_FORTIFY_STRSCPY()
192 src[3] = 'b'; in lkdtm_FORTIFY_STRSCPY()
198 strscpy(dst, src, strlen(src)); in lkdtm_FORTIFY_STRSCPY()
203 kfree(src); in lkdtm_FORTIFY_STRSCPY()