X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-abi.c;h=223c1ee4a5224ee3c723f1e6eae92c9d328850c7;hb=7456fae10d098df63e0542844bbcf1df050d3801;hp=a57e5e9f2acb699c899bba2fc2e1ccc5797be053;hpb=aa5d4c0dc4ba7a1f48a8a5e7e19888addc4548f0;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index a57e5e9f..223c1ee4 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -430,8 +430,8 @@ int lttng_abi_create_channel(struct file *session_file, transport_name = ""; break; } - if (atomic_long_add_unless(&session_file->f_count, - 1, INT_MAX) == INT_MAX) { + if (!atomic_long_add_unless(&session_file->f_count, 1, LONG_MAX)) { + ret = -EOVERFLOW; goto refcount_error; } /* @@ -1039,8 +1039,7 @@ int lttng_abi_create_event(struct file *channel_file, goto file_error; } /* The event holds a reference on the channel */ - if (atomic_long_add_unless(&channel_file->f_count, - 1, INT_MAX) == INT_MAX) { + if (!atomic_long_add_unless(&channel_file->f_count, 1, LONG_MAX)) { ret = -EOVERFLOW; goto refcount_error; }