diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-03-17 14:32:13 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-03-17 21:19:13 +0100 |
| commit | 2e9037c55f6a3308190ab4eb0ce110dddc7a6f2b (patch) | |
| tree | 7f97740e9d496a53a990d88a41405e67b8d4af44 /sys/test | |
| parent | 0bcbb36f9fff81ac0bff9ec0959b9ea4c444a700 (diff) | |
pkg/compiler: check that const values fit into base type
const[0x12345678, int8] is always an error, detect these cases.
Found some bugs in mptcp, socket proto and fuchsia fidl descriptions.
Diffstat (limited to 'sys/test')
| -rw-r--r-- | sys/test/gen/32_fork_shmem.go | 4 | ||||
| -rw-r--r-- | sys/test/gen/32_shmem.go | 4 | ||||
| -rw-r--r-- | sys/test/gen/64.go | 4 | ||||
| -rw-r--r-- | sys/test/gen/64_fork.go | 4 | ||||
| -rw-r--r-- | sys/test/test.txt | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/sys/test/gen/32_fork_shmem.go b/sys/test/gen/32_fork_shmem.go index 93c79568f..7c46923ff 100644 --- a/sys/test/gen/32_fork_shmem.go +++ b/sys/test/gen/32_fork_shmem.go @@ -491,7 +491,7 @@ var structDescs_32_fork_shmem = []*KeyedStruct{ {StructKey{Name: "syz_bf_struct0"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "syz_bf_struct0", TypeSize: 32}, Fields: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "syz_bf_flags", FldName: "f0", TypeSize: 8}, BitfieldLen: 10, BitfieldUnit: 2}, Vals: []uint64{0, 1, 2}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f1", TypeSize: 8}}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 66}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 2}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3"}, BitfieldOff: 5, BitfieldLen: 6, BitfieldUnit: 2}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f4", TypeSize: 4}, BitfieldOff: 11, BitfieldLen: 15, BitfieldUnit: 4}, Val: 66}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "f5", TypeSize: 2}, BitfieldLen: 11, BitfieldUnit: 2}, Path: []string{"parent"}}, @@ -1450,4 +1450,4 @@ var consts_32_fork_shmem = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_32_fork_shmem = "8b0c7eb98cd401cc01c2beb956ae849009a1d2d1" +const revision_32_fork_shmem = "1fba2cda053fcdf6511d4db184743d65230f9315" diff --git a/sys/test/gen/32_shmem.go b/sys/test/gen/32_shmem.go index df49539b0..4a890092d 100644 --- a/sys/test/gen/32_shmem.go +++ b/sys/test/gen/32_shmem.go @@ -488,7 +488,7 @@ var structDescs_32_shmem = []*KeyedStruct{ {StructKey{Name: "syz_bf_struct0"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "syz_bf_struct0", TypeSize: 24}, Fields: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "syz_bf_flags", FldName: "f0", TypeSize: 4}, BitfieldLen: 10, BitfieldUnit: 2}, Vals: []uint64{0, 1, 2}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f1", TypeSize: 8}}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 66}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 2}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3"}, BitfieldOff: 5, BitfieldLen: 6, BitfieldUnit: 2}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f4", TypeSize: 4}, BitfieldOff: 11, BitfieldLen: 15, BitfieldUnit: 4}, Val: 66}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "f5", TypeSize: 2}, BitfieldLen: 11, BitfieldUnit: 2}, Path: []string{"parent"}}, @@ -1444,4 +1444,4 @@ var consts_32_shmem = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_32_shmem = "be5d972f8dc2b75e7dc9f6626863df04f26fe121" +const revision_32_shmem = "003da4faad511684b515852654ae48b0f61c7e05" diff --git a/sys/test/gen/64.go b/sys/test/gen/64.go index c7c452e7e..801688b5d 100644 --- a/sys/test/gen/64.go +++ b/sys/test/gen/64.go @@ -493,7 +493,7 @@ var structDescs_64 = []*KeyedStruct{ {StructKey{Name: "syz_bf_struct0"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "syz_bf_struct0", TypeSize: 32}, Fields: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "syz_bf_flags", FldName: "f0", TypeSize: 8}, BitfieldLen: 10, BitfieldUnit: 2}, Vals: []uint64{0, 1, 2}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f1", TypeSize: 8}}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 66}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 2}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3"}, BitfieldOff: 5, BitfieldLen: 6, BitfieldUnit: 2}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f4", TypeSize: 4}, BitfieldOff: 11, BitfieldLen: 15, BitfieldUnit: 4}, Val: 66}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "f5", TypeSize: 2}, BitfieldLen: 11, BitfieldUnit: 2}, Path: []string{"parent"}}, @@ -1454,4 +1454,4 @@ var consts_64 = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64 = "36186e96efde25631acd856e90c680222ac62c9f" +const revision_64 = "78250fee4c7d10cc2980a171ea9a5eabfbc64b69" diff --git a/sys/test/gen/64_fork.go b/sys/test/gen/64_fork.go index d2c9437dd..df00ff36d 100644 --- a/sys/test/gen/64_fork.go +++ b/sys/test/gen/64_fork.go @@ -493,7 +493,7 @@ var structDescs_64_fork = []*KeyedStruct{ {StructKey{Name: "syz_bf_struct0"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "syz_bf_struct0", TypeSize: 32}, Fields: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "syz_bf_flags", FldName: "f0", TypeSize: 8}, BitfieldLen: 10, BitfieldUnit: 2}, Vals: []uint64{0, 1, 2}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f1", TypeSize: 8}}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 66}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f2"}, BitfieldLen: 5, BitfieldUnit: 2}, Val: 2}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3"}, BitfieldOff: 5, BitfieldLen: 6, BitfieldUnit: 2}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f4", TypeSize: 4}, BitfieldOff: 11, BitfieldLen: 15, BitfieldUnit: 4}, Val: 66}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "f5", TypeSize: 2}, BitfieldLen: 11, BitfieldUnit: 2}, Path: []string{"parent"}}, @@ -1450,4 +1450,4 @@ var consts_64_fork = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64_fork = "610b24588703473caa36384b1c2f57f4ac0c7c5f" +const revision_64_fork = "00445cbd8f546cf0230ccadd7db782648cffcba5" diff --git a/sys/test/test.txt b/sys/test/test.txt index 3b9b1d71d..21ae877e1 100644 --- a/sys/test/test.txt +++ b/sys/test/test.txt @@ -554,7 +554,7 @@ syz_bf_flags = 0, 1, 2 syz_bf_struct0 { f0 flags[syz_bf_flags, int16:10] f1 int64 - f2 const[0x42, int16:5] + f2 const[0x2, int16:5] f3 int16:6 f4 const[0x42, int32:15] f5 len[parent, int16:11] |
