/* * hex2hex reads stdin in Intel HEX format and produces an * (unsigned char) array which contains the bytes and writes it * to stdout using C syntax */ #include #include #include #define ABANDON(why) { fprintf(stderr, "%s\n", why); exit(1); } #define MAX_SIZE (256*1024) unsigned char buf[MAX_SIZE]; static int loadhex(FILE *inf, unsigned char *buf) { int l=0, c, i; while ((c=getc(inf))!=EOF) { if (c == ':') /* Sync with beginning of line */ { int n, check; unsigned char sum; int addr; int linetype; if (fscanf(inf, "%02x", &n) != 1) ABANDON("File format error"); sum = n; if (fscanf(inf, "%04x", &addr) != 1) ABANDON("File format error"); sum += addr/256; sum += addr%256; if (fscanf(inf, "%02x", &linetype) != 1) ABANDON("File format error"); sum += linetype; if (linetype != 0) continue; for (i=0;i= MAX_SIZE) ABANDON("File too large"); buf[addr++] = c; if (addr > l) l = addr; sum += c; } if (fscanf(inf, "%02x", &check) != 1) ABANDON("File format error"); sum = ~sum + 1; if (check != sum) ABANDON("Line checksum error"); } } return l; } int main( int argc, const char * argv [] ) { const char * varline; int i,l; int id=0; if(argv[1] && strcmp(argv[1], "-i")==0) { argv++; argc--; id=1; } if(argv[1]==NULL) { fprintf(stderr,"hex2hex: [-i] filename\n"); exit(1); } varline = argv[1]; l = loadhex(stdin, buf); printf("/*\n *\t Computer generated file. Do not edit.\n */\n"); printf("static int %s_len = %d;\n", varline, l); printf("static unsigned char %s[] %s = {\n", varline, id?"__initdata":""); for (i=0;icommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
commit396bf4cd835e62d70fad4a03a8963e61f19021f2 (patch)
tree79ac8f33554260fea1a8d43e6f8c4c5460115f45 /net/x25/x25_timer.c
parentd5adbfcd5f7bcc6fa58a41c5c5ada0e5c826ce2c (diff)
parent7c2cf1c4615cc2f576d0604406cdf0065f00b83b (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - use-after-free in algif_aead - modular aesni regression when pcbc is modular but absent - bug causing IO page faults in ccp - double list add in ccp - NULL pointer dereference in qat (two patches) - panic in chcr - NULL pointer dereference in chcr - out-of-bound access in chcr * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: chcr - Fix key length for RFC4106 crypto: algif_aead - Fix kernel panic on list_del crypto: aesni - Fix failure when pcbc module is absent crypto: ccp - Fix double add when creating new DMA command crypto: ccp - Fix DMA operations when IOMMU is enabled crypto: chcr - Check device is allocated before use crypto: chcr - Fix panic on dma_unmap_sg crypto: qat - zero esram only for DH85x devices crypto: qat - fix bar discovery for c62x
Diffstat (limited to 'net/x25/x25_timer.c')