[CRIU] [PATCH] util-fd: Use standard BUG_ON instead of hand-made

Pavel Emelyanov xemul at parallels.com
Thu Feb 26 12:27:37 PST 2015


On 02/26/2015 11:08 PM, Cyrill Gorcunov wrote:
> On Thu, Feb 26, 2015 at 11:03:43PM +0300, Pavel Emelyanov wrote:
>> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
>> ---
>>  pie/util-fd.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/pie/util-fd.c b/pie/util-fd.c
>> index 09d8ece..d90fd12 100644
>> --- a/pie/util-fd.c
>> +++ b/pie/util-fd.c
>> @@ -19,6 +19,8 @@
>>  #include "util-pie.h"
>>  #include "fcntl.h"
>>  
>> +#include "bug.h"
>> +
>>  static void scm_fdset_init_chunk(struct scm_fdset *fdset, int nr_fds)
>>  {
>>  	struct cmsghdr *cmsg;
>> @@ -153,8 +155,8 @@ int recv_fds(int sock, int *fds, int nr_fds, struct fd_opts *opts)
>>  		 * into files which do not have glibc and a couple of
>>  		 * sys_write_ helpers. Meawhile opencoded BUG_ON here.
>>  		 */
>> -		if (unlikely(min_fd > CR_SCM_MAX_FD))
>> -			*(volatile unsigned long *)NULL = 0xdead0000 + __LINE__;
>> +		BUG_ON(min_fd > CR_SCM_MAX_FD);
> 
> Have you tried to trigger it intentionally and verify that output is still readable?

No :) I assume that BUG_ON() is already checked to work properly in this case.

Thanks,
Pavel



More information about the CRIU mailing list