From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92026 invoked by alias); 17 Jan 2020 14:04:54 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 91946 invoked by uid 89); 17 Jan 2020 14:04:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-18.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Jan 2020 14:04:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579269879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0XPTKVDdbxVK/ogtD6S0hXQgDsr6xI9olJlwwYn1tB0=; b=PYFdp/N03ThtLDu5bSw2s38honnUPPnpfZ8xB3tCF2oV2xJIEGkCAhZ2tBZSwWFh53Fq5U Fx9buiOePxhQGqUT3axM+96UIeKlOL+BUkvq2BdY4PnH/+OJszQCiQhBc+I+voUm2R7fm/ 6ovyTrPDmF0xKScJmimtyPl+Jm1MMdA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-Fe0XGpeRMv6mB0TioNj76g-1; Fri, 17 Jan 2020 09:04:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5DA08010C0 for ; Fri, 17 Jan 2020 14:04:36 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-117-165.ams2.redhat.com [10.36.117.165]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D05481212 for ; Fri, 17 Jan 2020 14:04:36 +0000 (UTC) Received: by oldenburg2.str.redhat.com (Postfix, from userid 1000) id 0E3488299EE2; Fri, 17 Jan 2020 15:04:34 +0100 (CET) Date: Wed, 01 Jan 2020 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.30 COMMITTED] login: Remove double-assignment of fl.l_whence in try_file_lock User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20200117140435.0E3488299EE2@oldenburg2.str.redhat.com> From: Florian Weimer X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Fe0XGpeRMv6mB0TioNj76g-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00008.txt.bz2 Since l_whence is the second member of struct flock, it is written twice. The double-assignment is technically undefined behavior due to the lack of a sequence point. Reviewed-by: Carlos O'Donell Change-Id: I2baf9e70690e723c61051b25ccbd510aec15976c (cherry picked from commit b0a83ae71b2588bd2a9e6b40f95191602940e01e) diff --git a/login/utmp_file.c b/login/utmp_file.c index 2d0548f6fa..74ec622e96 100644 --- a/login/utmp_file.c +++ b/login/utmp_file.c @@ -79,7 +79,7 @@ try_file_lock (int fd, int type) struct flock64 fl = { .l_type = type, - fl.l_whence = SEEK_SET, + .l_whence = SEEK_SET, }; bool status = __fcntl64_nocancel (fd, F_SETLKW, &fl) < 0;