<div dir="ltr"><div>On Wed, Jun 6, 2018 at 2:35 AM Elazar Leibovich <<a href="mailto:elazarl@gmail.com">elazarl@gmail.com</a>> wrote:</div><div><br></div><div>$ git apply 0001-bpf-program-printed-in-bpf_debug-compatible-format.patch</div><div><br></div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:10: trailing whitespace.</div><div><span style="white-space:pre">             </span>int i;</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:11: trailing whitespace.</div><div><span style="white-space:pre">           </span>int n = MIN(len, BPF_MAXINSNS);</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:12: trailing whitespace.</div><div><span style="white-space:pre">          </span>tprintf("%hu", n); // bpf_debug requires <len>, prefix</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:13: trailing whitespace.</div><div><span style="white-space:pre">           </span>for (i=0; i<n; i++) {</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:14: trailing whitespace.</div><div><span style="white-space:pre">                 </span>struct bpf_filter_block filter;</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:15: trailing whitespace.</div><div><span style="white-space:pre">                  </span>tfetch_mem(tcp, addr + i*sizeof(filter),</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:16: trailing whitespace.</div><div><span style="white-space:pre">                                 </span>sizeof(filter), &filter);</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:17: trailing whitespace.</div><div><span style="white-space:pre">                    </span>tprintf(",%u %u %u %u", filter.code, filter.jt,</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:18: trailing whitespace.</div><div><span style="white-space:pre">                                                </span>filter.jf, filter.k);</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:19: trailing whitespace.</div><div><span style="white-space:pre">            </span>}</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:20: trailing whitespace.</div><div><span style="white-space:pre">                </span>if (n < len)</div><div>0001-bpf-program-printed-in-bpf_debug-compatible-format.patch:21: trailing whitespace.</div><div><span style="white-space:pre">                  </span>tprints("...");</div><div>fatal: 12 lines add whitespace errors.</div><div><br></div><div>please update the patch and read guide for new contributors [1].</div><div><br></div><div>> diff --git a/bpf_filter.c b/bpf_filter.c</div><div>> index a102e14..97f202b 100644</div><div>> --- a/bpf_filter.c</div><div>> +++ b/bpf_filter.c</div><div>> @@ -177,7 +177,18 @@ print_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,</div><div>>  <span style="white-space:pre">             </span>const unsigned short len, const print_bpf_filter_fn print_k)</div><div>>  {</div><div>>  <span style="white-space:pre">    </span>if (abbrev(tcp)) {</div><div>> -<span style="white-space:pre">              </span>printaddr(addr);</div><div>> +<span style="white-space:pre">                </span>int i;</div><div>> +<span style="white-space:pre">          </span>int n = MIN(len, BPF_MAXINSNS);</div><div>> +<span style="white-space:pre">         </span>tprintf("%hu", n); // bpf_debug requires <len>, prefix</div><div><br></div><div>Why you use %hu print int variable?</div><div><br></div><div>> +<span style="white-space:pre">              </span>for (i=0; i<n; i++) {</div><div>> +<span style="white-space:pre">                        </span>struct bpf_filter_block filter;</div><div>> +<span style="white-space:pre">                 </span>tfetch_mem(tcp, addr + i*sizeof(filter),</div><div>> +<span style="white-space:pre">                                        </span>sizeof(filter), &filter);</div><div>> +<span style="white-space:pre">                   </span>tprintf(",%u %u %u %u", filter.code, filter.jt,</div><div>> +<span style="white-space:pre">                                               </span>filter.jf, filter.k);</div><div>> +<span style="white-space:pre">           </span>}</div><div>> +<span style="white-space:pre">               </span>if (n < len)</div><div>> +<span style="white-space:pre">                 </span>tprints("...");</div><div><br></div><div>We can call the print_array to do the same thing.  Why you want to print in this</div><div>raw format?</div><div><br></div><div>>  <span style="white-space:pre">  </span>} else {</div><div>>  <span style="white-space:pre">               </span>struct bpf_filter_block_data fbd = { .fn = print_k };</div><div>>  <span style="white-space:pre">          </span>struct bpf_filter_block filter;</div><div>> </div><div><br></div><div>[1] <a href="https://strace.io/wiki/NewContributorGuide">https://strace.io/wiki/NewContributorGuide</a></div><div>--</div><div>Chen Jingpiao</div></div>