mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: MISRA 4.5 fixes to round_up()
MISRA Advisory Directive 4.5 states that identifiers in the same name space with overlapping visibility should be typographically unambiguous. The presence of both the roundup(x,y) and round_up(x,y) macros in the posix utils.h header incurs a violation of this rule. These macros were added to keep in sync with the linux kernel variants. However, there is a key distinction between how these two macros work in the linux kernel; roundup(x,y) can handle any y alignment while round_up(x,y) is intended to work only when y is a power-of-two. Passing a non-power-of-two alignment to round_up(x,y) results in an incorrect value being returned (silently). Because all current uses of roundup(x,y) and round_up(x,y) in nvgpu specify a y value that is a power-of-two and the underlying posix macro implementations assume as much, it is best to remove roundup(x,y) from nvgpu altogether to avoid any confusion. So this change converts all uses of roundup(x,y) to round_up(x,y). Jira NVGPU-3178 Change-Id: I0ee974d3e088fa704e251a38f6b7ada5a7600aec Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2271385 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
3f65316312
commit
ae44d384f3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -195,7 +195,7 @@ static void nvgpu_sim_esc_readl(struct gk20a *g,
|
||||
sim_escape_read_hdr_size());
|
||||
*sim_msg_param(g, 0) = index;
|
||||
*sim_msg_param(g, 4) = sizeof(u32);
|
||||
data_offset = roundup(pathlen + 1, sizeof(u32));
|
||||
data_offset = round_up(pathlen + 1, sizeof(u32));
|
||||
*sim_msg_param(g, 8) = data_offset + 0xc;
|
||||
strcpy((char *)sim_msg_param(g, 0xc), path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user