#ifndef __UDF_ENDIAN_H
#define __UDF_ENDIAN_H

#include <asm/byteorder.h>
#include <linux/string.h>

static inline struct kernel_lb_addr lelb_to_cpu(struct lb_addr in)
{
	struct kernel_lb_addr out;

	out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
	out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);

	return out;
}

static inline struct lb_addr cpu_to_lelb(struct kernel_lb_addr in)
{
	struct lb_addr out;

	out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
	out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);

	return out;
}

static inline struct short_ad lesa_to_cpu(struct short_ad in)
{
	struct short_ad out;

	out.extLength = le32_to_cpu(in.extLength);
	out.extPosition = le32_to_cpu(in.extPosition);

	return out;
}

static inline struct short_ad cpu_to_lesa(struct short_ad in)
{
	struct short_ad out;

	out.extLength = cpu_to_le32(in.extLength);
	out.extPosition = cpu_to_le32(in.extPosition);

	return out;
}

static inline struct kernel_long_ad lela_to_cpu(struct long_ad in)
{
	struct kernel_long_ad out;

	out.extLength = le32_to_cpu(in.extLength);
	out.extLocation = lelb_to_cpu(in.extLocation);

	return out;
}

static inline struct long_ad cpu_to_lela(struct kernel_long_ad in)
{
	struct long_ad out;

	out.extLength = cpu_to_le32(in.extLength);
	out.extLocation = cpu_to_lelb(in.extLocation);

	return out;
}

static inline struct kernel_extent_ad leea_to_cpu(struct extent_ad in)
{
	struct kernel_extent_ad out;

	out.extLength = le32_to_cpu(in.extLength);
	out.extLocation = le32_to_cpu(in.extLocation);

	return out;
}

#endif /* __UDF_ENDIAN_H */
fs/?id=9b8805a325591cf5b6b9df71200de25a2bd721fd'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools?showmsg=1'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools?id=9b8805a325591cf5b6b9df71200de25a2bd721fd'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools?id=9b8805a325591cf5b6b9df71200de25a2bd721fd'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools?id=9b8805a325591cf5b6b9df71200de25a2bd721fd'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools'>
<input type='hidden' name='id' value='9b8805a325591cf5b6b9df71200de25a2bd721fd'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=9b8805a325591cf5b6b9df71200de25a2bd721fd&amp;showmsg=1'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=9b8805a325591cf5b6b9df71200de25a2bd721fd&amp;showmsg=1'>tools</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools?id=9b8805a325591cf5b6b9df71200de25a2bd721fd'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr class='logheader'><td><span title='2017-02-06 22:50:04 -0500'>2017-02-06</span></td><td class='logsubject'><a href='/cgit.cgi/linux/net-next.git/commit/tools?id=63dfef75ed75364901d7caa52c6420cec3e73519'>bpf: enable verifier to add 0 to packet ptr</a></td><td>William Tu</td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+23</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
The patch fixes the case when adding a zero value to the packet
pointer.  The zero value could come from src_reg equals type
BPF_K or CONST_IMM.  The patch fixes both, otherwise the verifer
reports the following error:
  [...]
    R0=imm0,min_value=0,max_value=0
    R1=pkt(id=0,off=0,r=4)
    R2=pkt_end R3=fp-12
    R4=imm4,min_value=4,max_value=4
    R5=pkt(id=0,off=4,r=4)
  269: (bf) r2 = r0     // r2 becomes imm0
  270: (77) r2 &gt;&gt;= 3
  271: (bf) r4 = r1     // r4 becomes pkt ptr
  272: (0f) r4 += r2    // r4 += 0
  addition of negative constant to packet pointer is not allowed

Signed-off-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Mihai Budiu &lt;mbudiu@vmware.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;


</td></tr>
<tr class='logheader'><td><span title='2017-02-06 22:35:58 -0500'>2017-02-06</span></td><td class='logsubject'><a href='/cgit.cgi/linux/net-next.git/commit/tools?id=29200c199cc9bde59033ab30fcc40b6c8ae630b0'>bpf: test for AND edge cases</a></td><td>Josef Bacik</td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+55</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
These two tests are based on the work done for f23cc643f9ba.  The first test is
just a basic one to make sure we don't allow AND'ing negative values, even if it
would result in a valid index for the array.  The second is a cleaned up version
of the original testcase provided by Jann Horn that resulted in the commit.

Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;


</td></tr>