Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts/dtc: Update to upstream version v1.6.0-31-gcbca977ea121

This adds the following commits from upstream:

cbca977ea121 checks: Allow PCI bridge child nodes without an address
73e0f143b73d libfdt: fdt_strerror(): Fix comparison warning
6c2be7d85315 libfdt: fdt_get_string(): Fix sequential write comparison warnings
82525f41d59e libfdt: libfdt_wip: Fix comparison warning
fb1f65f15832 libfdt: fdt_create_with_flags(): Fix comparison warning
f28aa271000b libfdt: fdt_move(): Fix comparison warnings
3d7c6f44195a libfdt: fdt_add_string_(): Fix comparison warning
10f682788c30 libfdt: fdt_node_offset_by_phandle(): Fix comparison warning
07158f4cf2a2 libfdt: overlay: Fix comparison warning
ce9e1f25a7de libfdt: fdt_resize(): Fix comparison warning
faa76fc10bc5 libfdt: fdt_splice_(): Fix comparison warning
54dca0985316 libfdt: fdt_get_string(): Fix comparison warnings
f8e11e61624e libfdt: fdt_grab_space_(): Fix comparison warning
0c43d4d7bf5a libfdt: fdt_mem_rsv(): Fix comparison warnings
442ea3dd1579 libfdt: fdt_offset_ptr(): Fix comparison warnings
ca19c3db2bf6 Makefile: Specify cflags for libyaml
7bb86f1c0956 libfdt: fix fdt_check_node_offset_ w/ VALID_INPUT
3d522abc7571 dtc: Include stdlib.h in util.h
808cdaaf524f dtc: Avoid UB when shifting
3e3138b4a956 libfdt: fix fdt_check_full buffer overrun

Signed-off-by: Rob Herring <robh@kernel.org>

+58 -42
+1 -3
scripts/dtc/checks.c
··· 891 891 return; 892 892 893 893 prop = get_property(node, "reg"); 894 - if (!prop) { 895 - FAIL(c, dti, node, "missing PCI reg property"); 894 + if (!prop) 896 895 return; 897 - } 898 896 899 897 cells = (cell_t *)prop->val.val; 900 898 if (cells[1] || cells[2])
+2 -2
scripts/dtc/dtc-parser.y
··· 476 476 ; 477 477 478 478 integer_shift: 479 - integer_shift DT_LSHIFT integer_add { $$ = $1 << $3; } 480 - | integer_shift DT_RSHIFT integer_add { $$ = $1 >> $3; } 479 + integer_shift DT_LSHIFT integer_add { $$ = ($3 < 64) ? ($1 << $3) : 0; } 480 + | integer_shift DT_RSHIFT integer_add { $$ = ($3 < 64) ? ($1 >> $3) : 0; } 481 481 | integer_add 482 482 ; 483 483
+21 -10
scripts/dtc/libfdt/fdt.c
··· 134 134 135 135 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) 136 136 { 137 - unsigned absoffset = offset + fdt_off_dt_struct(fdt); 137 + unsigned int uoffset = offset; 138 + unsigned int absoffset = offset + fdt_off_dt_struct(fdt); 139 + 140 + if (offset < 0) 141 + return NULL; 138 142 139 143 if (!can_assume(VALID_INPUT)) 140 - if ((absoffset < offset) 144 + if ((absoffset < uoffset) 141 145 || ((absoffset + len) < absoffset) 142 146 || (absoffset + len) > fdt_totalsize(fdt)) 143 147 return NULL; 144 148 145 149 if (can_assume(LATEST) || fdt_version(fdt) >= 0x11) 146 - if (((offset + len) < offset) 150 + if (((uoffset + len) < uoffset) 147 151 || ((offset + len) > fdt_size_dt_struct(fdt))) 148 152 return NULL; 149 153 ··· 210 206 211 207 int fdt_check_node_offset_(const void *fdt, int offset) 212 208 { 213 - if (can_assume(VALID_INPUT)) 214 - return offset; 215 - if ((offset < 0) || (offset % FDT_TAGSIZE) 216 - || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) 209 + if (!can_assume(VALID_INPUT) 210 + && ((offset < 0) || (offset % FDT_TAGSIZE))) 211 + return -FDT_ERR_BADOFFSET; 212 + 213 + if (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE) 217 214 return -FDT_ERR_BADOFFSET; 218 215 219 216 return offset; ··· 222 217 223 218 int fdt_check_prop_offset_(const void *fdt, int offset) 224 219 { 225 - if ((offset < 0) || (offset % FDT_TAGSIZE) 226 - || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP)) 220 + if (!can_assume(VALID_INPUT) 221 + && ((offset < 0) || (offset % FDT_TAGSIZE))) 222 + return -FDT_ERR_BADOFFSET; 223 + 224 + if (fdt_next_tag(fdt, offset, &offset) != FDT_PROP) 227 225 return -FDT_ERR_BADOFFSET; 228 226 229 227 return offset; ··· 314 306 315 307 int fdt_move(const void *fdt, void *buf, int bufsize) 316 308 { 309 + if (!can_assume(VALID_INPUT) && bufsize < 0) 310 + return -FDT_ERR_NOSPACE; 311 + 317 312 FDT_RO_PROBE(fdt); 318 313 319 - if (fdt_totalsize(fdt) > bufsize) 314 + if (fdt_totalsize(fdt) > (unsigned int)bufsize) 320 315 return -FDT_ERR_NOSPACE; 321 316 322 317 memmove(buf, fdt, fdt_totalsize(fdt));
+2 -1
scripts/dtc/libfdt/fdt_overlay.c
··· 241 241 242 242 if (fixup_len % sizeof(uint32_t)) 243 243 return -FDT_ERR_BADOVERLAY; 244 + fixup_len /= sizeof(uint32_t); 244 245 245 246 tree_val = fdt_getprop(fdto, tree_node, name, &tree_len); 246 247 if (!tree_val) { ··· 251 250 return tree_len; 252 251 } 253 252 254 - for (i = 0; i < (fixup_len / sizeof(uint32_t)); i++) { 253 + for (i = 0; i < fixup_len; i++) { 255 254 fdt32_t adj_val; 256 255 uint32_t poffset; 257 256
+11 -9
scripts/dtc/libfdt/fdt_ro.c
··· 53 53 54 54 err = -FDT_ERR_BADOFFSET; 55 55 absoffset = stroffset + fdt_off_dt_strings(fdt); 56 - if (absoffset >= totalsize) 56 + if (absoffset >= (unsigned)totalsize) 57 57 goto fail; 58 58 len = totalsize - absoffset; 59 59 ··· 61 61 if (stroffset < 0) 62 62 goto fail; 63 63 if (can_assume(LATEST) || fdt_version(fdt) >= 17) { 64 - if (stroffset >= fdt_size_dt_strings(fdt)) 64 + if ((unsigned)stroffset >= fdt_size_dt_strings(fdt)) 65 65 goto fail; 66 66 if ((fdt_size_dt_strings(fdt) - stroffset) < len) 67 67 len = fdt_size_dt_strings(fdt) - stroffset; 68 68 } 69 69 } else if (fdt_magic(fdt) == FDT_SW_MAGIC) { 70 - if ((stroffset >= 0) 71 - || (stroffset < -fdt_size_dt_strings(fdt))) 70 + unsigned int sw_stroffset = -stroffset; 71 + 72 + if ((stroffset >= 0) || 73 + (sw_stroffset > fdt_size_dt_strings(fdt))) 72 74 goto fail; 73 - if ((-stroffset) < len) 74 - len = -stroffset; 75 + if (sw_stroffset < len) 76 + len = sw_stroffset; 75 77 } else { 76 78 err = -FDT_ERR_INTERNAL; 77 79 goto fail; ··· 159 157 160 158 static const struct fdt_reserve_entry *fdt_mem_rsv(const void *fdt, int n) 161 159 { 162 - int offset = n * sizeof(struct fdt_reserve_entry); 163 - int absoffset = fdt_off_mem_rsvmap(fdt) + offset; 160 + unsigned int offset = n * sizeof(struct fdt_reserve_entry); 161 + unsigned int absoffset = fdt_off_mem_rsvmap(fdt) + offset; 164 162 165 163 if (!can_assume(VALID_INPUT)) { 166 164 if (absoffset < fdt_off_mem_rsvmap(fdt)) ··· 682 680 { 683 681 int offset; 684 682 685 - if ((phandle == 0) || (phandle == -1)) 683 + if ((phandle == 0) || (phandle == ~0U)) 686 684 return -FDT_ERR_BADPHANDLE; 687 685 688 686 FDT_RO_PROBE(fdt);
+1 -1
scripts/dtc/libfdt/fdt_rw.c
··· 59 59 60 60 if ((oldlen < 0) || (soff + oldlen < soff) || (soff + oldlen > dsize)) 61 61 return -FDT_ERR_BADOFFSET; 62 - if ((p < (char *)fdt) || (dsize + newlen < oldlen)) 62 + if ((p < (char *)fdt) || (dsize + newlen < (unsigned)oldlen)) 63 63 return -FDT_ERR_BADOFFSET; 64 64 if (dsize - oldlen + newlen > fdt_totalsize(fdt)) 65 65 return -FDT_ERR_NOSPACE;
+2 -2
scripts/dtc/libfdt/fdt_strerror.c
··· 40 40 FDT_ERRTABENT(FDT_ERR_NOPHANDLES), 41 41 FDT_ERRTABENT(FDT_ERR_BADFLAGS), 42 42 }; 43 - #define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0])) 43 + #define FDT_ERRTABSIZE ((int)(sizeof(fdt_errtable) / sizeof(fdt_errtable[0]))) 44 44 45 45 const char *fdt_strerror(int errval) 46 46 { ··· 48 48 return "<valid offset/length>"; 49 49 else if (errval == 0) 50 50 return "<no error>"; 51 - else if (errval > -FDT_ERRTABSIZE) { 51 + else if (-errval < FDT_ERRTABSIZE) { 52 52 const char *s = fdt_errtable[-errval].str; 53 53 54 54 if (s)
+15 -12
scripts/dtc/libfdt/fdt_sw.c
··· 93 93 94 94 static void *fdt_grab_space_(void *fdt, size_t len) 95 95 { 96 - int offset = fdt_size_dt_struct(fdt); 97 - int spaceleft; 96 + unsigned int offset = fdt_size_dt_struct(fdt); 97 + unsigned int spaceleft; 98 98 99 99 spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt) 100 100 - fdt_size_dt_strings(fdt); ··· 108 108 109 109 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags) 110 110 { 111 - const size_t hdrsize = FDT_ALIGN(sizeof(struct fdt_header), 112 - sizeof(struct fdt_reserve_entry)); 111 + const int hdrsize = FDT_ALIGN(sizeof(struct fdt_header), 112 + sizeof(struct fdt_reserve_entry)); 113 113 void *fdt = buf; 114 114 115 115 if (bufsize < hdrsize) ··· 152 152 153 153 FDT_SW_PROBE(fdt); 154 154 155 + if (bufsize < 0) 156 + return -FDT_ERR_NOSPACE; 157 + 155 158 headsize = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); 156 159 tailsize = fdt_size_dt_strings(fdt); 157 160 ··· 162 159 headsize + tailsize > fdt_totalsize(fdt)) 163 160 return -FDT_ERR_INTERNAL; 164 161 165 - if ((headsize + tailsize) > bufsize) 162 + if ((headsize + tailsize) > (unsigned)bufsize) 166 163 return -FDT_ERR_NOSPACE; 167 164 168 165 oldtail = (char *)fdt + fdt_totalsize(fdt) - tailsize; ··· 250 247 static int fdt_add_string_(void *fdt, const char *s) 251 248 { 252 249 char *strtab = (char *)fdt + fdt_totalsize(fdt); 253 - int strtabsize = fdt_size_dt_strings(fdt); 254 - int len = strlen(s) + 1; 255 - int struct_top, offset; 250 + unsigned int strtabsize = fdt_size_dt_strings(fdt); 251 + unsigned int len = strlen(s) + 1; 252 + unsigned int struct_top, offset; 256 253 257 - offset = -strtabsize - len; 254 + offset = strtabsize + len; 258 255 struct_top = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); 259 - if (fdt_totalsize(fdt) + offset < struct_top) 256 + if (fdt_totalsize(fdt) - offset < struct_top) 260 257 return 0; /* no more room :( */ 261 258 262 - memcpy(strtab + offset, s, len); 259 + memcpy(strtab - offset, s, len); 263 260 fdt_set_size_dt_strings(fdt, strtabsize + len); 264 - return offset; 261 + return -offset; 265 262 } 266 263 267 264 /* Must only be used to roll back in case of error */
+1 -1
scripts/dtc/libfdt/fdt_wip.c
··· 23 23 if (!propval) 24 24 return proplen; 25 25 26 - if (proplen < (len + idx)) 26 + if ((unsigned)proplen < (len + idx)) 27 27 return -FDT_ERR_NOSPACE; 28 28 29 29 memcpy((char *)propval + idx, val, len);
+1
scripts/dtc/util.h
··· 2 2 #ifndef UTIL_H 3 3 #define UTIL_H 4 4 5 + #include <stdlib.h> 5 6 #include <stdarg.h> 6 7 #include <stdbool.h> 7 8 #include <getopt.h>
+1 -1
scripts/dtc/version_gen.h
··· 1 - #define DTC_VERSION "DTC 1.6.0-g9d7888cb" 1 + #define DTC_VERSION "DTC 1.6.0-gcbca977e"