Fix internal error at the end of the tarball.
[releases.git] / deblob-check
index 20cb7f1ba0bd8b3970c70df8dfe2a0de23f19623..a81daa1bc904fa8b017257a5ba37c24012d7e0b5 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# deblob-check version 2009-03-17
+# deblob-check version 2009-03-18
 # Inspired in gNewSense's find-firmware script.
 # Written by Alexandre Oliva <lxoliva@fsfla.org>
 
 #              context around the blobs.
 
 # -X --print-all-matches: print all blobs, be they known false
-#              positives or blobs.
+#              positives or actual blobs.
 
 # -x --list-all-matches: list files that contain sequences that appear
 #              to be blobs, be they known false positives or not.
 
 # -p --mark-false-positives: print the processed input, replacing
-#              sequences that match the blob detector test, but that
-#              are known to be false positives, with /*(DEBLOBBED)*/.
+#              sequences that match the blob detector test, even those 
+#              known to be false positives, with /*(DEBLOBBED)*/.
 
 # -P --list-false-positives: list files that contain false positives.
 
@@ -845,8 +845,8 @@ set_except () {
     accept '[/][*][*][\n] [*] request_firmware_nowait: asynchronous version[^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
     accept 'EXPORT_SYMBOL(request_firmware\(_nowait\)\?);' drivers/base/firmware_class.c
     accept 'int request_firmware\(_nowait\)\?([^;]*);' include/linux/firmware.h
-    accept 'static inline int request_firmware\(_nowait\)\?([^{]*)[\n]{[\n][\t]return -EINVAL;[\n]}[\n]' include/linux/firmware.h
-    accept 'static inline int \(maybe_\)\?reject_firmware\(_nowait\)\?([^{;]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/firmware.h
+    accept 'static inline int request_firmware\(_nowait\)\?([^{]*)[\n]{[\n][\t]return -EINVAL;[\n]}' include/linux/firmware.h
+    accept 'static inline int[\n]\(maybe_\)\?reject_firmware\(_nowait\)\?([^{;]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}' include/linux/firmware.h
 
     accept 'static inline int request_ihex_firmware\?([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/ihex.h
     ocomment '[/][*] Optional firmware\([^\n]*[\n] [*]\)*[^\n]* MODULE_FIRMWARE()'
@@ -889,7 +889,7 @@ set_except () {
 
     blob '    sprintf([^;]*fore200[^;]*FW_EXT[^;]*);' drivers/atm/fore200e.c
     blobname '\(pc\|sb\)a200e\(_ecd\)\?\.bin[12]?' drivers/atm/fore200e.c
-    blobna 'The supplied firmware images.*fore.*Rebuild and reinstall[^.]*\.' Documentation/networking/fore200e.txt
+    blobna 'The supplied firmware images.*fore.*Rebuild and re-install[^.]*\.' Documentation/networking/fore200e.txt
 
     blobname 'intelliport2\.bin' drivers/char/ip2/ip2main.c
 
@@ -957,6 +957,7 @@ set_except () {
 
     blobna 'static u16 \(sr\|twinax\)_edc\[\] = {[^;]*};' drivers/net/cxgb3/ael1002.c
     blobna 'for ([^\n]*ARRAY_SIZE(\(sr\|twinax\)_edc)[^\n]*)[\n][^;]*mdio_write[^;]*;' drivers/net/cxgb3/ael1002.c
+    blobname 't3fw\(_protocol_sram\)\?-\(%d\|[0-9]*\)\.\(%d\|[0-9]*\)\.\(%d\|[0-9]*\)\.bin' drivers/net/cxgb3/cxgb3_main.c
 
     blob '\([/][*][*]*[*][/][\n]*\)*\([/][*]\([^/]\|[^*/][/]*\)*Micro code\([^/]\|[^*/][/]*\)*8086:\([^/]\|[^*/][/]*\)*[*][/]\([\n]*[/][*]\([^/]\|[^*/][/]*\)*[*][/]\)*\|#define  *D10\(1M\(_B\)\?\|1S\|2_E\)_\(CPUSAVER_\(TIMER\|BUNDLE\|MIN_SIZE\)_DWORD\|RCVBUNDLE_UCODE\)[         ]\(\\[\n]\|[^\n]\)*\)\([\n]*[/][*]\([^/]\|[^*/][/]*\|[*][/][\n]*[/][*]\)*Micro code\([^/]\|[^*/][/]*\)*8086:\([^/]\|[^*/][/]*\)*[*][/]\([\n]*[/][*]\([^/]\|[^*/][/]*\)*[*][/]\)*\|[\n][\n]*#define  *D10\(1M\(_B\)\?\|1S\|2_E\)_\(CPUSAVER_\(TIMER\|BUNDLE\|MIN_SIZE\)_DWORD\|RCVBUNDLE_UCODE\)[        ]\(\\[\n]\|[^\n]\)*\)*' drivers/net/e100.c
     blobna '\([/][*]\([^/]\|[*][/]*\)*[*][/][\n]*              \)\(ucode\[opts->\(timer\|bundle\|min_size\)_dword\] .= [^;]*;[\n][\n]*         \)*[^}]*UCODE_SIZE[^}]*cb_ucode[^}]*return;[\n] }' drivers/net/e100.c
@@ -1043,13 +1044,15 @@ set_except () {
     blob 'yamaha[/]yss225_registers\.bin' sound/isa/wavefront/wavefront_fx.c
     blobna 'firmware = [&]yss225_registers_firmware;' sound/isa/wavefront/wavefront_fx.c
     blob 'static const struct firmware yss225_registers_firmware = {[^;]*};' sound/isa/wavefront/wavefront_fx.c
-    blob 'wavefront\.os' sound/isa/wavefront/wavefront_synth.c
+    blob 'ospath[       ]*- Pathname[^\n]ICS2115.*wavefront\.os\([^\n]\|[^.][\n]\)*' Documentation/sound/alsa/ALSA-Configuration.txt
+    blobname 'wavefront\.os' sound/isa/wavefront/wavefront_synth.c
 
     blobna 'and[\n]require the use of[^\n]*propr\?ietary[^:]*' Documentation/arm/IXP4xx
     blob 'If you need to use any of the above[^\n]*download[^:]*:[\n   ]*http:[^\n]*ixp4[^\n]*' Documentation/arm/IXP4xx
 
     accept 'int xc_request_firmware(struct xc *[*] *x);' arch/arm/mach-netx/include/mach/xc.h
     accept 'int xc_request_firmware(struct xc *[*] *x)[\n]{' arch/arm/mach-netx/xc.c
+    accept '           dev_err(x->dev, "request_firmware failed\\n");' arch/arm/mach-netx/xc.c
     accept 'EXPORT_SYMBOL(xc_request_firmware);' arch/arm/mach-netx/xc.c
     accept '           if (xc_request_firmware(priv->xc)) {' drivers/net/netx-eth.c
 
@@ -1078,7 +1081,7 @@ set_except () {
 
     blobname 'isi\(6\(08\|\(08\|16\)em\)\|46\(08\|16\)\)\.bin' drivers/char/isicom.c
 
-    blobname 'c\(218t\|p204\|320t\)unx\.code' drivers/char/moxa.c
+    blobname 'c\(218t\|p204\|320t\)unx\.cod' drivers/char/moxa.c
     accept '           printk(KERN_ERR "MOXA: request_firmware failed' drivers/char/moxa.c
 
     # This driver enables the user to update the non-Free BIOS, but it
@@ -1086,7 +1089,8 @@ set_except () {
     # doesn't require any non-Free firwmare to function, and it
     # doesn't actually recommend users to perform updates, so I'm
     # leaving it in.
-    accept '                   req_firm_rc = request_firmware_nowait([^;], "dell_rbu",' drivers/firmware/dell_rbu.c
+    accept '                   req_firm_rc = request_firmware_nowait([^;]*, "dell_rbu",' drivers/firmware/dell_rbu.c
+    accept '   *"dell_rbu:%s request_firmware_nowait"' drivers/firmware/dell_rbu.c
 
     blobname 'xc3028-v27\.fw' drivers/media/common/tuners/tuner-xc2028.h
     blobname 'xc3028L-v36\.fw' drivers/media/common/tuners/tuner-xc2028.h
@@ -1117,15 +1121,19 @@ set_except () {
     accept '    [*] request_firmware() is synchronous' 'drivers/net/iwlwifi/iwl\(3945-base\|-agn\)\.c'
 
     blobname 'libertas_cs\(_helper\)\?\.fw' drivers/net/wireless/libertas/if_cs.c
-
     blobname 'sd\(8385\|8686\)\(_helper\)\?\.bin' drivers/net/wireless/libertas/if_sdio.c
-
     blobname 'usb8388\(-5\.126\.0\.p5\)\?\.bin' drivers/net/wireless/libertas/if_usb.c
-    accept '           lbs_pr_err("request_firmware() failed' drivers/net/wireless/ipw2200.c
+    accept '           lbs_pr_err("request_firmware() failed' drivers/net/wireless/if_usb.c
+    blobna 'o\. Copy the firmware image[^\n]*usb8388\([^\n]\|[\n][     ]*[^    \n]\)*' drivers/net/wireless/libertas/README
+    blobna '\[fw_name=usb8388[^]]*\]' drivers/net/wireless/libertas/README
+
+    blobname 'usb8388\.bin' drivers/base/Kconfig
 
     blobname 'lbtf_usb\.bin' drivers/net/wireless/libertas_tf/if_usb.c
 
     blobname 'isl38\(86\|87usb_bare\|90usb\)' 'drivers/net/wireless/p54/p54\(pci\.c\|usb\.[ch]\)'
+    blob '[/][*] for isl3886 register definitions\([^/]\|[^*][/]*\)*[*][/]' drivers/net/wireless/p54/p54usb.h
+    blobna 'If you enable this\([^\n]\|[\n][   ]*[^    \n]\)*isl3890\([^\n]\|[\n][     ]*[^    \n]\)*' drivers/net/wireless/Kconfig
 
     blobname 'isl38\(77\|86\|90\)' drivers/net/wireless/prism54/islpci_dev.c
 
@@ -1208,6 +1216,7 @@ set_except () {
 
     blobname '\(pcxhr[/]\)\?\(x[ic]_1_882\.dat\|[ebd]321_512\.[ebd]56\)' sound/pci/pcxhr/pcxhr_hwdep.c
 
+    blobna 'You need to install[\n]*riptide\.hex[\n]\.[\n]' Documentation/sound/alsa/ALSA-Configuration.txt
     blobname 'riptide\.hex' sound/pci/riptide/riptide.c
 
     blobname '\(multi\|digi\)face_firmware\(_rev11\)\?\.bin' sound/pci/rme9652/hdsp.c
@@ -1225,6 +1234,7 @@ set_except () {
     accept '   PERMCODESIZE = mod_firmware_load(PERMCODEFILE, [&]PERMCODE);' sound/oss/msnd_pinnacle.c
     blobname '\([/]etc[/]sound[/]\)\?pndsp\(ini\|erm\)\.bin' sound/oss/msnd_pinnacle.h
     blobname '\([/]etc[/]sound[/]\)\?msnd\(init\|perm\)\.bin' sound/oss/msnd_classic.h
+    blobna '\(Important Notes - Read Before Using\|Obtaining and Creating Firmware Files\)[\n]#  ~*\([^\n]\|[\n]# *\([\n]# *\([\n]# *For the[^\n]*[\n]# *~*[\n]\)\?\)\?[^\n ]\)*\.' Documentation/sound/oss/MultiSound
 
     accept '   len = mod_firmware_load(fn, [&]data);[\n]       if [^{]* {[\n]          printk(KERN_ERR "sscape:' sound/oss/sscape.c
     blobname '[/]sndscape[/]scope\.co[dx]' sound/oss/sscape.c
@@ -1235,8 +1245,12 @@ set_except () {
     accept '           smw_ucodeLen = mod_firwmare_load(' sound/oss/sb_common.c
     blobname '\([/]etc[/]sound[/]\)\?msnd\(init\|perm\)\.bin' sound/oss/sb_common.c
 
+    blob 'When the module is loaded\([^\n]\|[\n][^\n]\)*[/]pss_synth\([^\n]\|[\n][^\n]\)*' Documentation/sound/oss/PSS
+    blob 'pss_firmware[ \n     ]*This parameter\([^\n]\|[\n][^\n]\)*[/]pss_synth\([^\n]\|[\n][^\n]\)*' Documentation/sound/oss/PSS-updates
     accept '           pss_synthLen = mod_firmware_load(pss_firmware' sound/oss/pss.c
     blobname '\([/]etc[/]sound[/]\)\?pss_synth' sound/oss/pss.c
+    accept '   \$(obj)[/]bin2hex pss_synth' sound/oss/Makefile
+    accept '    *echo '"'"'static \(unsigned char [*] *\|int \)pss_synth\(Len\)\? = \(NULL\|0\);' sound/oss/Makefile
     
     accept '   \.request_firmware = NULL,' drivers/media/dvb/dvb-usb/m920x.c
 
@@ -1320,6 +1334,8 @@ set_except () {
 
     blobname 'dvb-usb-digitv-02\.fw' drivers/media/dvb/dvb-usb/digitv.c
 
+    blob 'Driver: \(korg1212\|maestro3\|ymfpci\|smctr\|kaweth\|ttusb-budget\|keyspan\|emi26\|emi62\|tu_usb_3410_5052\|whiteheat\|ip2\|CPiA2\|DABUSB\|USB_VICAM\|USB_SERIAL_EDGEPORT\(_TI\)\?\|SND_SB16_CSP\|CASSINI\) --* \([^\n]\|[\n]*[^\n\-]\)*\([\n][\n]--*[\n][\n]Driver: \(korg1212\|maestro3\|ymfpci\|smctr\|kaweth\|ttusb-budget\|keyspan\|emi26\|emi62\|tu_usb_3410_5052\|whiteheat\|ip2\|CPiA2\|DABUSB\|USB_VICAM\|USB_SERIAL_EDGEPORT\(_TI\)\?\|SND_SB16_CSP\|CASSINI\) --* \([^\n]\|[\n]*[^\n\-]\)*\)*' firmware/WHENCE
+
     # This looks suspicious, but it pretty much just sets stuff to zero.
     initnc 'static __u8 mode8420\(pro\|con\)\[\] =' drivers/media/video/cs8420.h
 
@@ -2113,7 +2129,7 @@ set_sedmain () {
 
   # Regular expression that matches one or more blobs without
   # intervening line breaks.
-  sblobctx="\\([^\\n]*$bloblong\\)\\+"
+  sblobctx="\\(\([^\\n]\|[/][*](DEBLOB-\\nBED)[*][/]\)*$bloblong\\)\\+"
 
   # Regular expression that matches the context for a long blob match.
   lblobctx="\\($initblob\\|$defineblob\\|$asmblob\\|$sblobctx\\)"
@@ -2138,12 +2154,14 @@ g;
   fi
 
   sedmain="
+/^$/N;
 /^[\n]\?;[/][*]\\(end .*\\)\\?[*][/];$/{
   $4;
   d;
 }
 /^;[/][*]begin /!{
   : internal_error
+  $v:internal_error
   i\\
 Internal error at
   p;
@@ -2161,8 +2179,9 @@ n;
 H;
 g;
 $4
-s/^\(;[/][*]begin [^\n]*[\n]\)*//;
-s/\\($bol;[/][*]\\(end [^\n]*\\)\\?[*][/];\\)*$//;
+$v:read all
+s/^\\(;[/][*]begin [^\n]*[\\n]\\)*//;
+s/\\($bol[\n]\?;[/][*]\\(end [^\\n]*\\)\\?[*][/];\\)*$//;
 $v:???!blobfast
 /$blobfast/!b clean;
 $check_false_positives
@@ -2255,6 +2274,7 @@ $v:print_blobs
   # This is tricky.  We don't want to print the false positive.
   /^$falsepos[^\\n]*$blobfast/ {
     $v:delete false positive immediately followed by blob
+    s/^\\($falsepos\\)/\\1\/*(DEBLOB-\\nBED)*\//;
     h;
     s/^\\($falsepos\\).*/\\1/;
     $v:matched false positive
@@ -2269,10 +2289,12 @@ $v:print_blobs
     G;
     b print_blobs_delete_to_eol;
   }
-  s/^$falsepos//;
-  b print_blobs_delete_to_eol;
+  /^$falsepos[/][*](DEBLOB-\\nBED)[*][/]/! {
+    s/^$falsepos//;
+    b print_blobs_delete_to_eol;
+  }
 }
-/^[^\\n]*$blobfast/! {
+/^\([^\\n]\|[/][*](DEBLOB-\\nBED)[*][/]\)*$blobfast/! {
   $v:delete non-blob header
   h;
   s/[\\n]\\($falsepos\\|[^\\n]*$blobfast\\).*//;
@@ -2288,9 +2310,15 @@ $v:print_blobs
   x;
   b print_blobs_delete_to_eol;
 }
-h;
 i\\
 ::: $file :::
+: print_blobs_output_false_positive;
+/[^\\n]*[/][*](DEBLOB-[\\n]BED)[*][/]/ {
+  P;
+  s,^[^\\n]*[\\n],,
+  b print_blobs_output_false_positive;
+}
+h;
 s/^\\([^\\n]*\\($bloblong[^\\n]*\\)\\+\\)\\([\\n].*\\)\\?$/\\1/;
 $v:narrowed to blob
 p;
@@ -2310,6 +2338,7 @@ $v:print_marked_blobs
   # This is tricky.  We don't want to print the false positive.
   /^$falsepos[^\\n]*$blobfast/ {
     $v:delete false positive immediately followed by blob
+    s/^\\($falsepos\\)/\\1\/*(DEBLOB-\\nBED)*\//;
     h;
     s/^\\($falsepos\\).*/\\1/;
     $v:matched false positive
@@ -2324,10 +2353,12 @@ $v:print_marked_blobs
     G;
     b print_marked_blobs_delete_to_eol;
   }
-  s/^falsepos//;
-  b print_marked_blobs_delete_to_eol;
+  /^$falsepos[/][*](DEBLOB-\\nBED)[*][/]/! {
+    s/^falsepos//;
+    b print_marked_blobs_delete_to_eol;
+  }
 }
-/^[^\\n]*$blobfast/! {
+/^\([^\\n]\|[/][*](DEBLOB-\\nBED)[*][/]\)*$blobfast/! {
   $v:delete non-blob header
   h;
   s/[\\n]\\($falsepos\\|[^\\n]*$blobfast\\).*//;
@@ -2343,9 +2374,15 @@ $v:print_marked_blobs
   x;
   b print_marked_blobs_delete_to_eol;
 }
-h;
 i\\
 ::: $file :::
+: print_marked_blobs_output_false_positive;
+/[^\\n]*[/][*](DEBLOB-[\\n]BED)[*][/]/ {
+  P;
+  s,^[^\\n]*[\\n],,
+  b print_marked_blobs_output_false_positive;
+}
+h;
 s/^\\([^\\n]*\\($bloblong[^\\n]*\\)\\+\\)\\([\\n].*\\)\\?$/\\1/;
 $v:narrowed to blob
 s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[     ]*;/{\/*(DEBLOBBED)*\/};/g;
@@ -2367,6 +2404,7 @@ $v:print_cblobs
   # This is tricky.  We don't want to print the false positive.
   /^$falsepos[^\\n]*$blobfast/ {
     $v:delete false positive immediately followed by blob
+    s/^\\($falsepos\\)/\\1\/*(DEBLOB-\\nBED)*\//;
     h;
     s/^\\($falsepos\\).*/\\1/;
     $v:matched false positive
@@ -2381,8 +2419,10 @@ $v:print_cblobs
     G;
     b print_cblobs_delete_to_eol;
   }
-  s/^$falsepos//;
-  b print_cblobs_delete_to_eol;
+  /^$falsepos[/][*](DEBLOB-\\nBED)[*][/]/! {
+    s/^$falsepos//;
+    b print_cblobs_delete_to_eol;
+  }
 }
 /^$lblobctx/! {
   $v:delete non-blob header
@@ -2400,9 +2440,15 @@ $v:print_cblobs
   x;
   b print_cblobs_delete_to_eol;
 }
-h;
 i\\
 ::: $file :::
+: print_cblobs_output_false_positive;
+/[^\\n]*[/][*](DEBLOB-[\\n]BED)[*][/]/ {
+  P;
+  s,^[^\\n]*[\\n],,
+  b print_cblobs_output_false_positive;
+}
+h;
 s/^\\($lblobctx[^\\n]*\\($bloblong[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/;
 $v:narrowed to blob
 p;
@@ -2422,6 +2468,7 @@ $v:print_marked_cblobs
   # This is tricky.  We don't want to print the false positive.
   /^$falsepos[^\\n]*$blobfast/ {
     $v:delete false positive immediately followed by blob
+    s/^\\($falsepos\\)/\\1\/*(DEBLOB-\\nBED)*\//;
     h;
     s/^\\($falsepos\\).*/\\1/;
     $v:matched false positive
@@ -2436,8 +2483,10 @@ $v:print_marked_cblobs
     G;
     b print_marked_cblobs_delete_to_eol;
   }
-  s/^$falsepos//;
-  b print_marked_cblobs_delete_to_eol;
+  /^$falsepos[/][*](DEBLOB-\\nBED)[*][/]/! {
+    s/^$falsepos//;
+    b print_marked_cblobs_delete_to_eol;
+  }
 }
 /^$lblobctx/! {
   $v:delete non-blob header
@@ -2455,9 +2504,15 @@ $v:print_marked_cblobs
   x;
   b print_marked_cblobs_delete_to_eol;
 }
-h;
 i\\
 ::: $file :::
+: print_marked_cblobs_output_false_positive;
+/[^\\n]*[/][*](DEBLOB-[\\n]BED)[*][/]/ {
+  P;
+  s,^[^\\n]*[\\n],,
+  b print_marked_cblobs_output_false_positive;
+}
+h;
 s/^\\($lblobctx[^\\n]*\\($bloblong[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/;
 $v:narrowed to blob
 s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[     ]*;/{\/*(DEBLOBBED)*\/};/g;
@@ -2547,8 +2602,9 @@ $v:list_blobs
   # This is tricky.  We don't want to deblob the false positive.
   /^$falsepos[^\\n]*$blobfast/ {
     $v:print false positive immediately followed by blob
+    s/^\\($falsepos\\)/\\1\/*(DEBLOB-\\nBED)*\//;
     h;
-    s/^\\($falsepos\\)[^\\n]*$blobfast.*/\\1/;
+    s/^\\($falsepos\\).*/\\1/;
     : list_blobs_match_loop
     /[\\n]/ {
       P;
@@ -2742,7 +2798,17 @@ check () {
   fi
   set "$@" "$cmd"
 
-  test $# != 1 || set "$@" "cat"
+  sedunbreak='
+: restart;
+/[/][*](DEBLOB-$/ {
+  N;
+  s,[/][*](DEBLOB-[\n]BED)[*][/],,
+  b restart;
+}'
+  cmd='sed "$sedunbreak"'
+  set "$@" "$cmd"
+
+  # test $# = 1 || set "$@" "cat"
 
   shift # fnord goes out here