Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164682
b: refs/heads/master
c: 8c87df4
h: refs/heads/master
v: v3
  • Loading branch information
Jan Beulich authored and Linus Torvalds committed Sep 23, 2009
1 parent 8e03495 commit b42eaf5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1fe72eaa0f46a0fa4cdcd8f3f7853b6d39469784
refs/heads/master: 8c87df457cb58fe75b9b893007917cf8095660a0
2 changes: 1 addition & 1 deletion trunk/arch/sparc/include/asm/vio.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static inline void *vio_dring_entry(struct vio_dring_state *dr,
static inline u32 vio_dring_avail(struct vio_dring_state *dr,
unsigned int ring_size)
{
BUILD_BUG_ON(!is_power_of_2(ring_size));
MAYBE_BUILD_BUG_ON(!is_power_of_2(ring_size));

return (dr->pending -
((dr->prod - dr->cons) & (ring_size - 1)));
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ int __tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)

cmd.header.in = pcrread_header;
cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx);
BUILD_BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE);
BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE);
rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
"attempting to read a pcr value");

Expand Down Expand Up @@ -760,7 +760,7 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
return -ENODEV;

cmd.header.in = pcrextend_header;
BUILD_BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5615,7 +5615,7 @@ static void niu_init_tx_mac(struct niu *np)
/* The XMAC_MIN register only accepts values for TX min which
* have the low 3 bits cleared.
*/
BUILD_BUG_ON(min & 0x7);
BUG_ON(min & 0x7);

if (np->flags & NIU_FLAGS_XMAC)
niu_init_tx_xmac(np, min, max);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/gfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
((1 << ZONES_SHIFT) - 1);

if (__builtin_constant_p(bit))
BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
else {
#ifdef CONFIG_DEBUG_VM
BUG_ON((GFP_ZONE_BAD >> bit) & 1);
Expand Down
8 changes: 6 additions & 2 deletions trunk/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -678,13 +678,17 @@ struct sysinfo {
};

/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))

/* Force a compilation error if condition is constant and true */
#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))

/* Force a compilation error if condition is true, but also produce a
result (of value 0 and type size_t), so the expression can be used
e.g. in a structure initializer (or where-ever else comma expressions
aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))

/* Trap pasters of __FUNCTION__ at compile-time */
#define __FUNCTION__ (__func__)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/kmemcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
\
_n = (long) &((ptr)->name##_end) \
- (long) &((ptr)->name##_begin); \
BUILD_BUG_ON(_n < 0); \
MAYBE_BUILD_BUG_ON(_n < 0); \
\
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
} while (0)
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/linux/virtio_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
unsigned int fbit)
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
BUILD_BUG_ON(fbit >= 32);
MAYBE_BUILD_BUG_ON(fbit >= 32);

if (fbit < VIRTIO_TRANSPORT_F_START)
virtio_check_driver_offered_feature(vdev, fbit);
Expand Down

0 comments on commit b42eaf5

Please sign in to comment.