Skip to content

Commit

Permalink
Fix memset_s parameter
Browse files Browse the repository at this point in the history
Signed-off-by: cytsai0409 <cytsai0409@gmail.com>
  • Loading branch information
cytsai0409 committed May 3, 2023
1 parent cf3567b commit cf15593
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (C) 2010-2019 Jean Delvare <jdelvare@suse.de>
*/

#define __STDC_WANT_LIB_EXT1__ 1
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/i2c.h>
Expand Down Expand Up @@ -397,7 +398,11 @@ void i2c_register_spd(struct i2c_adapter *adap)
struct i2c_board_info info;
unsigned short addr_list[2];

memset_s(&info, 0, sizeof(struct i2c_board_info));
#ifdef __STDC_LIB_EXT1__
memset_s(&info, sizeof(struct i2c_board_info), 0, sizeof(struct i2c_board_info));
#else
memset(&info, 0, sizeof(struct i2c_board_info));
#endif
strlcpy(info.type, name, I2C_NAME_SIZE);
addr_list[0] = 0x50 + n;
addr_list[1] = I2C_CLIENT_END;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/* enable dev_dbg print out */
//#define DEBUG

#define __STDC_WANT_LIB_EXT1__ 1
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -216,7 +217,11 @@ static int sys_eeprom_probe(struct i2c_client *client,
goto exit;
}

memset_s(data->data, 0xff, EEPROM_SIZE);
#ifdef __STDC_LIB_EXT1__
memset_s(data->data, EEPROM_SIZE, 0xff, EEPROM_SIZE);
#else
memset(data->data, 0xff, EEPROM_SIZE);
#endif
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);

Expand Down

0 comments on commit cf15593

Please sign in to comment.