Summary: | x11/nvidia-driver: nvidia_subr.c:367:26: error: 'memset' call operates on objects of type ... | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | O. Hartmann <ohartmann> | ||||
Component: | Individual Port(s) | Assignee: | Ben Woods <woodsb02> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Many People | CC: | danfe, david, mjg, sascha.folie, tijl, woodsb02 | ||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(danfe) |
||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
O. Hartmann
2018-06-02 19:36:47 UTC
I also encountered this, during my attempt to perform a src-based update of head/amd64 from: FreeBSD g1-215.catwhisker.org 12.0-CURRENT FreeBSD 12.0-CURRENT #5 r334528M/334528:1200066: Sat Jun 2 04:16:28 PDT 2018 root@g1-215.catwhisker.org:/common/S4/obj/usr/src/amd64.amd64/sys/CANARY amd64 to r334542. So it appears that (at least) one of the updates between r334529 - r334535 (inclusive) has catalyzed the problem. Based on a quick glance at each of the 7 commit messages, I'm suspecting r334533 and/or r334534, Given that this error is about memset, and r334533 and r334534 are the 2 commits in the dissected range which modify head/sys/libkern/memset.c, I agree with David's suspicions that the issue is with one of these commits. Copying in Mateusz (mjg) who made the recent memset changes. Mateusz: any idea what the issue is here? Konstantin (kib@) had mentioned in email: | Even not looking at the actual code, I am quite sure that the line | nvidia_subr.c:367 should be changed to | memset(ci, 0, sizeof(*ci)); | This is a bug in the driver sources. Looking closer, I think the memset changes made by mjg in 334533 have simply revealed an existing bug in the nvidia driver. The code in the nvidia driver is: struct nv_ioctl_card_info *ci; ... memset(ci, 0, sizeof(ci)); As per the compiler error, the argument in the sizeof function should be dereferenced: - memset(ci, 0, sizeof(ci)); + memset(ci, 0, sizeof(*ci)); Created attachment 193982 [details]
Patch to fix nvidia driver memset(3) usage
Requesting approval from danfe@ as maintainer to commit this patch.
Note that poudriere testing shows this fixes the build of the following ports on FreeBSD-12 CURRENT: x11/nvidia-driver x11/nvidia-driver-304 x11/nvidia-driver-340 Note that it is also fixing a bug in the driver that applies equally on older versions of FreeBSD. Yes, this is a bug in the driver code and should be fixed. The patch is correct, but I'm not quite comfortable with adding more patches, esp. for such a trivial change. Let me try to work our a sed(1)-based solution first. Fair enough. The reason I went with a patch solution is because this is a change which should definitely be upstreamed. I've notified upstream: https://devtalk.nvidia.com/default/topic/1036229/ A commit references this bug: Author: danfe Date: Mon Jun 4 17:38:36 UTC 2018 New revision: 471574 URL: https://svnweb.freebsd.org/changeset/ports/471574 Log: Unbreak nVidia drivers on recent -CURRENT, after memset() changes by mjg@ in r334533 have revealed an existing bug in the nVidia code. PR: 228709 Changes: head/x11/nvidia-driver/Makefile |