X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-abi.c;h=bee4255d47b4832d15dc2b48d2bc1514b7b41568;hb=64eff4764737408d0805a57ce95e564600e06c98;hp=c45c10f42c747fa4d553d08d18900b5bca1a9e08;hpb=436ca2bdb05daec97c40422f83fc68c13f90cd8f;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index c45c10f4..bee4255d 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -429,8 +429,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; } /* @@ -1038,8 +1038,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; }