mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 13:17:49 +00:00
lib: fix prefix_copy() for clang-SA
https://bugs.llvm.org/show_bug.cgi?id=42811 Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
4d5cf6bc46
commit
4937287fb9
@ -628,6 +628,10 @@ int prefix_match_network_statement(const struct prefix *n,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
#undef prefix_copy /* cf. prefix.h */
|
||||||
|
#endif
|
||||||
|
|
||||||
void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
|
void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
|
||||||
{
|
{
|
||||||
struct prefix *dest = udest.p;
|
struct prefix *dest = udest.p;
|
||||||
|
@ -416,6 +416,14 @@ extern int prefix_common_bits(const struct prefix *, const struct prefix *);
|
|||||||
extern void prefix_copy(union prefixptr, union prefixconstptr);
|
extern void prefix_copy(union prefixptr, union prefixconstptr);
|
||||||
extern void apply_mask(struct prefix *);
|
extern void apply_mask(struct prefix *);
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
/* clang-SA doesn't understand transparent unions, making it think that the
|
||||||
|
* target of prefix_copy is uninitialized. So just memset the target.
|
||||||
|
* cf. https://bugs.llvm.org/show_bug.cgi?id=42811
|
||||||
|
*/
|
||||||
|
#define prefix_copy(a, b) ({ memset(a, 0, sizeof(*a)); prefix_copy(a, b); })
|
||||||
|
#endif
|
||||||
|
|
||||||
extern struct prefix *sockunion2prefix(const union sockunion *dest,
|
extern struct prefix *sockunion2prefix(const union sockunion *dest,
|
||||||
const union sockunion *mask);
|
const union sockunion *mask);
|
||||||
extern struct prefix *sockunion2hostprefix(const union sockunion *,
|
extern struct prefix *sockunion2hostprefix(const union sockunion *,
|
||||||
|
Loading…
Reference in New Issue
Block a user