Skip to content

Fix unsafe uses of unsafe.Pointer#1438

Merged
dcantah merged 1 commit intomicrosoft:masterfrom
dcantah:unsafeptr-queryjobinfo
Jun 23, 2022
Merged

Fix unsafe uses of unsafe.Pointer#1438
dcantah merged 1 commit intomicrosoft:masterfrom
dcantah:unsafeptr-queryjobinfo

Conversation

@dcantah
Copy link
Copy Markdown
Contributor

@dcantah dcantah commented Jun 23, 2022

Per rule 4 of unsafe.Pointer usage, conversion of a unsafe.Pointer
to a uinptr to pass to the syscall.Syscall family should only be done in
the argument list. We had a couple spots where we were passing it in as
an argument to a small wrapper function until it reached the underlying
syscall.Syscall*.

https://pkg.go.dev/unsafe#Pointer

Per rule 4 of unsafe.Pointer usage, conversion of a unsafe.Pointer
to a uinptr to pass to the syscall.Syscall family should only be done in
the argument list. We had a couple spots where we were passing it in as
an argument to a small wrapper function until it reached the underlying
syscall.Syscall*.

https://pkg.go.dev/unsafe#Pointer

Signed-off-by: Daniel Canter <[email protected]>
@dcantah dcantah requested a review from a team as a code owner June 23, 2022 00:31
@dcantah
Copy link
Copy Markdown
Contributor Author

dcantah commented Jun 23, 2022

@kevpar @helsaawy

Copy link
Copy Markdown
Member

@kevpar kevpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

@helsaawy helsaawy self-assigned this Jun 23, 2022
Copy link
Copy Markdown
Contributor

@helsaawy helsaawy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we can replace this with a generic version in the future.
Or use systemInformation interface{} along with reflect.(Value).UnsafePointer() and reflect.(Type).Size()....

@dcantah dcantah merged commit 1ec8cad into microsoft:master Jun 23, 2022
kiashok pushed a commit to kiashok/hcsshim that referenced this pull request Jul 11, 2022
Per rule 4 of unsafe.Pointer usage, conversion of a unsafe.Pointer
to a uinptr to pass to the syscall.Syscall family should only be done in
the argument list. We had a couple spots where we were passing it in as
an argument to a small wrapper function until it reached the underlying
syscall.Syscall*.

https://pkg.go.dev/unsafe#Pointer

Signed-off-by: Daniel Canter <[email protected]>
dcantah added a commit to dcantah/hcsshim that referenced this pull request Jul 21, 2022
Per rule 4 of unsafe.Pointer usage, conversion of a unsafe.Pointer
to a uinptr to pass to the syscall.Syscall family should only be done in
the argument list. We had a couple spots where we were passing it in as
an argument to a small wrapper function until it reached the underlying
syscall.Syscall*.

https://pkg.go.dev/unsafe#Pointer

Signed-off-by: Daniel Canter <[email protected]>
(cherry picked from commit 1ec8cad)
Signed-off-by: Daniel Canter <[email protected]>
anmaxvl added a commit that referenced this pull request Feb 7, 2023
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
Per rule 4 of unsafe.Pointer usage, conversion of a unsafe.Pointer
to a uinptr to pass to the syscall.Syscall family should only be done in
the argument list. We had a couple spots where we were passing it in as
an argument to a small wrapper function until it reached the underlying
syscall.Syscall*.

https://pkg.go.dev/unsafe#Pointer

Signed-off-by: Daniel Canter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants