Commit 164bcb94bc821fcbac752e809b4ac7c6f15d13b5

Authored by Alex Deucher
Committed by Dave Airlie
1 parent be66305718

drm/radeon/kms: i2c s/sprintf/snprintf/g for safety

As per advice from Jean Delvare.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

drivers/gpu/drm/radeon/radeon_i2c.c
... ... @@ -896,7 +896,8 @@
896 896 ((rdev->family <= CHIP_RS480) ||
897 897 ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) {
898 898 /* set the radeon hw i2c adapter */
899   - sprintf(i2c->adapter.name, "Radeon i2c hw bus %s", name);
  899 + snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
  900 + "Radeon i2c hw bus %s", name);
900 901 i2c->adapter.algo = &radeon_i2c_algo;
901 902 ret = i2c_add_adapter(&i2c->adapter);
902 903 if (ret) {
... ... @@ -905,7 +906,8 @@
905 906 }
906 907 } else {
907 908 /* set the radeon bit adapter */
908   - sprintf(i2c->adapter.name, "Radeon i2c bit bus %s", name);
  909 + snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
  910 + "Radeon i2c bit bus %s", name);
909 911 i2c->adapter.algo_data = &i2c->algo.bit;
910 912 i2c->algo.bit.pre_xfer = pre_xfer;
911 913 i2c->algo.bit.post_xfer = post_xfer;
... ... @@ -946,7 +948,8 @@
946 948 i2c->rec = *rec;
947 949 i2c->adapter.owner = THIS_MODULE;
948 950 i2c->dev = dev;
949   - sprintf(i2c->adapter.name, "Radeon aux bus %s", name);
  951 + snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
  952 + "Radeon aux bus %s", name);
950 953 i2c_set_adapdata(&i2c->adapter, i2c);
951 954 i2c->adapter.algo_data = &i2c->algo.dp;
952 955 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;