Skip to content

Commit

Permalink
compare mem_topology sizes before memcmp on the contents
Browse files Browse the repository at this point in the history
  • Loading branch information
rradjabi authored Oct 5, 2018
1 parent b60c915 commit b2998d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/runtime_src/driver/xclng/drm/xocl/userpf/xocl_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,8 @@ xocl_read_axlf_helper(struct xocl_dev *xdev, struct drm_xocl_axlf *axlf_ptr)

/* Compare MEM_TOPOLOGY previous vs new. Ignore this and keep disable preserve_mem if not for aws.*/
if (xocl_is_aws(xdev) && (xdev->topology != NULL)) {
// m_mem_data can be of different length but we would not compare them if topology match fails
if (!memcmp(new_topology, xdev->topology, size) &&
(sizeof_sect(new_topology, m_mem_data) == sizeof_sect(xdev->topology, m_mem_data))) {
if ( (size == sizeof_sect(xdev->topology, m_mem_data)) &&
!memcmp(new_topology, xdev->topology, size) ) {
printk(KERN_INFO "XOCL: MEM_TOPOLOGY match, preserve mem_topology.\n");
preserve_mem = 1;
} else {
Expand Down

0 comments on commit b2998d9

Please sign in to comment.