Bug 108465

Summary: xorg-server-1.20.2/hw/xfree86/fbdevhw/fbdevhw.c:339: possible ")" in wrong place ?
Product: xorg Reporter: dcb314
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description dcb314 2018-10-17 07:40:07 UTC
xorg-server-1.20.2/hw/xfree86/fbdevhw/fbdevhw.c:339]: (style) Checking if unsigned variable 'sizeof(buf)' is less than zero.

Source code is

        if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
            readlink(sysfs_path, buf, sizeof(buf) < 0) ||
            strstr(buf, "devices/pci")) {

Maybe better code

        if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
            readlink(sysfs_path, buf, sizeof(buf)) < 0 ||
            strstr(buf, "devices/pci")) {
Comment 1 Alan Coopersmith 2018-10-17 17:02:00 UTC
Already fixed yesterday:
https://gitlab.freedesktop.org/xorg/xserver/commit/71703e4e8bd00719eefad53c2ed6c604079f87ea

Thanks for the report!
Comment 2 Alan Coopersmith 2018-10-17 17:02:59 UTC
Sorry, wrong commit link, should have been:
https://gitlab.freedesktop.org/xorg/xserver/commit/bd5fe7593fd0df236f3b2be1f062166ddba7d67c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.