lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <11675f60-3f56-d3a7-e8f8-1544c7a8567d@users.sourceforge.net>
Date:   Thu, 19 Jan 2017 10:38:37 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     Jeff Dike <jdike@...toit.com>,
        user-mode-linux-devel@...ts.sourceforge.net
Cc:     user-mode-linux-user@...ts.sourceforge.net,
        Anton Ivanov <aivanov@...-begemot.co.uk>,
        Dan Williams <dan.j.williams@...el.com>,
        Hannes Reinecke <hare@...e.com>, Jens Axboe <axboe@...com>,
        Richard Weinberger <richard@....at>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org, Wolfram Sang <wsa@...-dreams.de>
Subject: Re: [PATCH 2/5] um: port: Delete three error messages for a failed
 memory allocation

>> +++ b/arch/um/drivers/port_kern.c
>> @@ -87,11 +87,8 @@ static int port_accept(struct port_list *port)
>>  	}
>>  
>>  	conn = kmalloc(sizeof(*conn), GFP_ATOMIC);
>> -	if (conn == NULL) {
>> -		printk(KERN_ERR "port_accept : failed to allocate "
>> -		       "connection\n");
>> +	if (!conn)
>>  		goto out_close;
>> -	}
>>  	*conn = ((struct connection)
>>  		{ .list 	= LIST_HEAD_INIT(conn->list),
>>  		  .fd 		= fd,
> 
> I don't see how this eliminates a possible error.

The suggested change affects three coding style issues at this place.

* Repetition of an out-of-memory message

  See also:
  http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

* Unwanted splitting of a message string

* Usage of a specific preprocessor symbol


> !x is something you use with something that is conceptually a Boolean.

Pointers can be also treated in this way, can't they?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ